
<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies &#8212; pymatgen 2020.7.3 documentation</title>
    <link rel="stylesheet" href="../../../../../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../../../../../" src="../../../../../_static/documentation_options.js"></script>
    <script src="../../../../../_static/jquery.js"></script>
    <script src="../../../../../_static/underscore.js"></script>
    <script src="../../../../../_static/doctools.js"></script>
    <script src="../../../../../_static/language_data.js"></script>
    <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="index" title="Index" href="../../../../../genindex.html" />
    <link rel="search" title="Search" href="../../../../../search.html" />
 
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-33990148-1']);
  _gaq.push(['_trackPageview']);
</script>

  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../../../index.html">pymatgen 2020.7.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../../../index.html" >Module code</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../../../../pymatgen.html" accesskey="U">pymatgen</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <h1>Source code for pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies</h1><div class="highlight"><pre>
<span></span><span class="c1"># coding: utf-8</span>
<span class="c1"># Copyright (c) Pymatgen Development Team.</span>
<span class="c1"># Distributed under the terms of the MIT License.</span>


<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">This module provides so-called &quot;strategies&quot; to determine the coordination environments of an atom in a structure.</span>
<span class="sd">Some strategies can favour larger or smaller environments. Some strategies uniquely identifies the environments while</span>
<span class="sd">some others can identify the environment as a &quot;mix&quot; of several environments, each of which is assigned with a given</span>
<span class="sd">fraction. The choice of the strategy depends on the purpose of the user.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="n">__author__</span> <span class="o">=</span> <span class="s2">&quot;David Waroquiers&quot;</span>
<span class="n">__copyright__</span> <span class="o">=</span> <span class="s2">&quot;Copyright 2012, The Materials Project&quot;</span>
<span class="n">__credits__</span> <span class="o">=</span> <span class="s2">&quot;Geoffroy Hautier&quot;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;2.0&quot;</span>
<span class="n">__maintainer__</span> <span class="o">=</span> <span class="s2">&quot;David Waroquiers&quot;</span>
<span class="n">__email__</span> <span class="o">=</span> <span class="s2">&quot;david.waroquiers@gmail.com&quot;</span>
<span class="n">__date__</span> <span class="o">=</span> <span class="s2">&quot;Feb 20, 2016&quot;</span>

<span class="kn">import</span> <span class="nn">abc</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">monty.json</span> <span class="kn">import</span> <span class="n">MSONable</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Dict</span>

<span class="kn">from</span> <span class="nn">pymatgen.symmetry.analyzer</span> <span class="kn">import</span> <span class="n">SpacegroupAnalyzer</span>
<span class="kn">from</span> <span class="nn">pymatgen.core.operations</span> <span class="kn">import</span> <span class="n">SymmOp</span>
<span class="kn">from</span> <span class="nn">pymatgen.core.sites</span> <span class="kn">import</span> <span class="n">PeriodicSite</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">scipy.stats</span> <span class="kn">import</span> <span class="n">gmean</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.utils.coordination_geometry_utils</span> <span class="kn">import</span> <span class="n">get_lower_and_upper_f</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.utils.func_utils</span> <span class="kn">import</span> <span class="n">CSMFiniteRatioFunction</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.utils.func_utils</span> <span class="kn">import</span> <span class="n">CSMInfiniteRatioFunction</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.utils.func_utils</span> <span class="kn">import</span> <span class="n">DeltaCSMRatioFunction</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.utils.func_utils</span> <span class="kn">import</span> <span class="n">RatioFunction</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.utils.chemenv_errors</span> <span class="kn">import</span> <span class="n">EquivalentSiteSearchError</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.coordination_environments.coordination_geometries</span> <span class="kn">import</span> <span class="n">AllCoordinationGeometries</span>
<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.utils.defs_utils</span> <span class="kn">import</span> <span class="n">AdditionalConditions</span>

<span class="kn">from</span> <span class="nn">pymatgen.analysis.chemenv.coordination_environments.voronoi</span> <span class="kn">import</span> <span class="n">DetailedVoronoiContainer</span>
<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">OrderedDict</span>

<span class="n">module_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="vm">__file__</span><span class="p">))</span>

<span class="n">MPSYMBOL_TO_CN</span> <span class="o">=</span> <span class="n">AllCoordinationGeometries</span><span class="p">()</span><span class="o">.</span><span class="n">get_symbol_cn_mapping</span><span class="p">()</span>
<span class="n">ALLCG</span> <span class="o">=</span> <span class="n">AllCoordinationGeometries</span><span class="p">()</span>


<div class="viewcode-block" id="StrategyOption"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.StrategyOption">[docs]</a><span class="k">class</span> <span class="nc">StrategyOption</span><span class="p">(</span><span class="n">MSONable</span><span class="p">,</span> <span class="n">metaclass</span><span class="o">=</span><span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span><span class="p">):</span>
    <span class="n">allowed_values</span> <span class="o">=</span> <span class="kc">None</span>  <span class="c1"># type: Optional[str]</span>

<div class="viewcode-block" id="StrategyOption.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.StrategyOption.as_dict">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        A JSON serializable dict representation of this strategy option.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">pass</span></div></div>


<div class="viewcode-block" id="DistanceCutoffFloat"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceCutoffFloat">[docs]</a><span class="k">class</span> <span class="nc">DistanceCutoffFloat</span><span class="p">(</span><span class="nb">float</span><span class="p">,</span> <span class="n">StrategyOption</span><span class="p">):</span>
    <span class="n">allowed_values</span> <span class="o">=</span> <span class="s1">&#39;Real number between 1.0 and +infinity&#39;</span>

    <span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">myfloat</span><span class="p">):</span>
        <span class="n">flt</span> <span class="o">=</span> <span class="nb">float</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">myfloat</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">flt</span> <span class="o">&lt;</span> <span class="mf">1.0</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Distance cutoff should be between 1.0 and +infinity&quot;</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">flt</span>

<div class="viewcode-block" id="DistanceCutoffFloat.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceCutoffFloat.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s1">&#39;@module&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s1">&#39;@class&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s1">&#39;value&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="p">}</span></div>

<div class="viewcode-block" id="DistanceCutoffFloat.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceCutoffFloat.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s1">&#39;value&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="AngleCutoffFloat"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleCutoffFloat">[docs]</a><span class="k">class</span> <span class="nc">AngleCutoffFloat</span><span class="p">(</span><span class="nb">float</span><span class="p">,</span> <span class="n">StrategyOption</span><span class="p">):</span>
    <span class="n">allowed_values</span> <span class="o">=</span> <span class="s1">&#39;Real number between 0.0 and 1.0&#39;</span>

    <span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">myfloat</span><span class="p">):</span>
        <span class="n">flt</span> <span class="o">=</span> <span class="nb">float</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">myfloat</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">flt</span> <span class="o">&lt;</span> <span class="mf">0.0</span> <span class="ow">or</span> <span class="n">flt</span> <span class="o">&gt;</span> <span class="mf">1.0</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Angle cutoff should be between 0.0 and 1.0&quot;</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">flt</span>

<div class="viewcode-block" id="AngleCutoffFloat.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleCutoffFloat.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s1">&#39;@module&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s1">&#39;@class&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s1">&#39;value&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="p">}</span></div>

<div class="viewcode-block" id="AngleCutoffFloat.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleCutoffFloat.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s1">&#39;value&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="CSMFloat"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CSMFloat">[docs]</a><span class="k">class</span> <span class="nc">CSMFloat</span><span class="p">(</span><span class="nb">float</span><span class="p">,</span> <span class="n">StrategyOption</span><span class="p">):</span>
    <span class="n">allowed_values</span> <span class="o">=</span> <span class="s1">&#39;Real number between 0.0 and 100.0&#39;</span>

    <span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">myfloat</span><span class="p">):</span>
        <span class="n">flt</span> <span class="o">=</span> <span class="nb">float</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">myfloat</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">flt</span> <span class="o">&lt;</span> <span class="mf">0.0</span> <span class="ow">or</span> <span class="n">flt</span> <span class="o">&gt;</span> <span class="mf">100.0</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Continuous symmetry measure limits should be between 0.0 and 100.0&quot;</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">flt</span>

<div class="viewcode-block" id="CSMFloat.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CSMFloat.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s1">&#39;@module&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s1">&#39;@class&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s1">&#39;value&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="p">}</span></div>

<div class="viewcode-block" id="CSMFloat.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CSMFloat.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s1">&#39;value&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="AdditionalConditionInt"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AdditionalConditionInt">[docs]</a><span class="k">class</span> <span class="nc">AdditionalConditionInt</span><span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="n">StrategyOption</span><span class="p">):</span>
    <span class="n">allowed_values</span> <span class="o">=</span> <span class="s1">&#39;Integer amongst :</span><span class="se">\n</span><span class="s1">&#39;</span>
    <span class="k">for</span> <span class="n">integer</span><span class="p">,</span> <span class="n">description</span> <span class="ow">in</span> <span class="n">AdditionalConditions</span><span class="o">.</span><span class="n">CONDITION_DESCRIPTION</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
        <span class="n">allowed_values</span> <span class="o">+=</span> <span class="s1">&#39; - </span><span class="si">{:d}</span><span class="s1"> for &quot;</span><span class="si">{}</span><span class="s1">&quot;</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">integer</span><span class="p">,</span> <span class="n">description</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">integer</span><span class="p">):</span>
        <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">integer</span><span class="p">))</span> <span class="o">!=</span> <span class="nb">str</span><span class="p">(</span><span class="n">integer</span><span class="p">):</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Additional condition </span><span class="si">{}</span><span class="s2"> is not an integer&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">integer</span><span class="p">)))</span>
        <span class="n">intger</span> <span class="o">=</span> <span class="nb">int</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">integer</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">intger</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">AdditionalConditions</span><span class="o">.</span><span class="n">ALL</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Additional condition </span><span class="si">{:d}</span><span class="s2"> is not allowed&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">integer</span><span class="p">))</span>
        <span class="k">return</span> <span class="n">intger</span>

<div class="viewcode-block" id="AdditionalConditionInt.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AdditionalConditionInt.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s1">&#39;@module&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s1">&#39;@class&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s1">&#39;value&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="p">}</span></div>

<div class="viewcode-block" id="AdditionalConditionInt.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AdditionalConditionInt.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s1">&#39;value&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="AbstractChemenvStrategy"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy">[docs]</a><span class="k">class</span> <span class="nc">AbstractChemenvStrategy</span><span class="p">(</span><span class="n">MSONable</span><span class="p">,</span> <span class="n">metaclass</span><span class="o">=</span><span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Class used to define a Chemenv strategy for the neighbors and coordination environment to be applied to a</span>
<span class="sd">    StructureEnvironments object</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">AC</span> <span class="o">=</span> <span class="n">AdditionalConditions</span><span class="p">()</span>
    <span class="n">STRATEGY_OPTIONS</span> <span class="o">=</span> <span class="n">OrderedDict</span><span class="p">()</span>  <span class="c1"># type: Dict[str, Dict]</span>
    <span class="n">STRATEGY_DESCRIPTION</span> <span class="o">=</span> <span class="kc">None</span>  <span class="c1"># type: str</span>
    <span class="n">STRATEGY_INFO_FIELDS</span> <span class="o">=</span> <span class="p">[]</span>  <span class="c1"># type: List</span>
    <span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span> <span class="o">=</span> <span class="s1">&#39;csm_wcs_ctwcc&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Abstract constructor for the all chemenv strategies.</span>
<span class="sd">        :param structure_environments: StructureEnvironments object containing all the information on the</span>
<span class="sd">            coordination of the sites in a structure</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="k">if</span> <span class="n">structure_environments</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">set_structure_environments</span><span class="p">(</span><span class="n">structure_environments</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span> <span class="o">=</span> <span class="n">symmetry_measure_type</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">symmetry_measure_type</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span>

<div class="viewcode-block" id="AbstractChemenvStrategy.set_structure_environments"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.set_structure_environments">[docs]</a>    <span class="k">def</span> <span class="nf">set_structure_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span> <span class="o">=</span> <span class="n">structure_environments</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">voronoi</span><span class="p">,</span> <span class="n">DetailedVoronoiContainer</span><span class="p">):</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Voronoi Container not of type &quot;DetailedVoronoiContainer&quot;&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">prepare_symmetries</span><span class="p">()</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.prepare_symmetries"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.prepare_symmetries">[docs]</a>    <span class="k">def</span> <span class="nf">prepare_symmetries</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">spg_analyzer</span> <span class="o">=</span> <span class="n">SpacegroupAnalyzer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">structure</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">symops</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">spg_analyzer</span><span class="o">.</span><span class="n">get_symmetry_operations</span><span class="p">()</span>
        <span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">symops</span> <span class="o">=</span> <span class="p">[]</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.equivalent_site_index_and_transform"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.equivalent_site_index_and_transform">[docs]</a>    <span class="k">def</span> <span class="nf">equivalent_site_index_and_transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">psite</span><span class="p">):</span>
        <span class="c1"># Get the index of the site in the unit cell of which the PeriodicSite psite is a replica.</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">isite</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">structure</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">psite</span><span class="p">)</span>
        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
            <span class="k">try</span><span class="p">:</span>
                <span class="n">uc_psite</span> <span class="o">=</span> <span class="n">psite</span><span class="o">.</span><span class="n">to_unit_cell</span><span class="p">()</span>
                <span class="n">isite</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">structure</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">uc_psite</span><span class="p">)</span>
            <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
                <span class="k">for</span> <span class="n">isite2</span><span class="p">,</span> <span class="n">site2</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">structure</span><span class="p">):</span>
                    <span class="k">if</span> <span class="n">psite</span><span class="o">.</span><span class="n">is_periodic_image</span><span class="p">(</span><span class="n">site2</span><span class="p">):</span>
                        <span class="n">isite</span> <span class="o">=</span> <span class="n">isite2</span>
                        <span class="k">break</span>
        <span class="c1"># Get the translation between psite and its corresponding site in the unit cell (Translation I)</span>
        <span class="n">thissite</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">structure</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="n">dthissite</span> <span class="o">=</span> <span class="n">psite</span><span class="o">.</span><span class="n">frac_coords</span> <span class="o">-</span> <span class="n">thissite</span><span class="o">.</span><span class="n">frac_coords</span>
        <span class="c1"># Get the translation between the equivalent site for which the neighbors have been computed and the site in</span>
        <span class="c1"># the unit cell that corresponds to psite (Translation II)</span>
        <span class="n">equivsite</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">structure</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">sites_map</span><span class="p">[</span><span class="n">isite</span><span class="p">]]</span><span class="o">.</span><span class="n">to_unit_cell</span><span class="p">()</span>
        <span class="c1"># equivsite = self.structure_environments.structure[self.structure_environments.sites_map[isite]]</span>
        <span class="n">dequivsite</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">structure</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">sites_map</span><span class="p">[</span><span class="n">isite</span><span class="p">]]</span><span class="o">.</span><span class="n">frac_coords</span>
                      <span class="o">-</span> <span class="n">equivsite</span><span class="o">.</span><span class="n">frac_coords</span><span class="p">)</span>
        <span class="n">found</span> <span class="o">=</span> <span class="kc">False</span>
        <span class="c1"># Find the symmetry that applies the site in the unit cell to the equivalent site, as well as the translation</span>
        <span class="c1"># that gets back the site to the unit cell (Translation III)</span>
        <span class="c1"># TODO: check that these tolerances are needed, now that the structures are refined before analyzing envs</span>
        <span class="n">tolerances</span> <span class="o">=</span> <span class="p">[</span><span class="mf">1e-8</span><span class="p">,</span> <span class="mf">1e-7</span><span class="p">,</span> <span class="mf">1e-6</span><span class="p">,</span> <span class="mf">1e-5</span><span class="p">,</span> <span class="mf">1e-4</span><span class="p">]</span>
        <span class="k">for</span> <span class="n">tolerance</span> <span class="ow">in</span> <span class="n">tolerances</span><span class="p">:</span>
            <span class="k">for</span> <span class="n">symop</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">symops</span><span class="p">:</span>
                <span class="n">newsite</span> <span class="o">=</span> <span class="n">PeriodicSite</span><span class="p">(</span><span class="n">equivsite</span><span class="o">.</span><span class="n">_species</span><span class="p">,</span> <span class="n">symop</span><span class="o">.</span><span class="n">operate</span><span class="p">(</span><span class="n">equivsite</span><span class="o">.</span><span class="n">frac_coords</span><span class="p">),</span> <span class="n">equivsite</span><span class="o">.</span><span class="n">_lattice</span><span class="p">)</span>
                <span class="k">if</span> <span class="n">newsite</span><span class="o">.</span><span class="n">is_periodic_image</span><span class="p">(</span><span class="n">thissite</span><span class="p">,</span> <span class="n">tolerance</span><span class="o">=</span><span class="n">tolerance</span><span class="p">):</span>
                    <span class="n">mysym</span> <span class="o">=</span> <span class="n">symop</span>
                    <span class="n">dthissite2</span> <span class="o">=</span> <span class="n">thissite</span><span class="o">.</span><span class="n">frac_coords</span> <span class="o">-</span> <span class="n">newsite</span><span class="o">.</span><span class="n">frac_coords</span>
                    <span class="n">found</span> <span class="o">=</span> <span class="kc">True</span>
                    <span class="k">break</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">found</span><span class="p">:</span>
                <span class="n">symops</span> <span class="o">=</span> <span class="p">[</span><span class="n">SymmOp</span><span class="o">.</span><span class="n">from_rotation_and_translation</span><span class="p">()]</span>
                <span class="k">for</span> <span class="n">symop</span> <span class="ow">in</span> <span class="n">symops</span><span class="p">:</span>
                    <span class="n">newsite</span> <span class="o">=</span> <span class="n">PeriodicSite</span><span class="p">(</span><span class="n">equivsite</span><span class="o">.</span><span class="n">_species</span><span class="p">,</span> <span class="n">symop</span><span class="o">.</span><span class="n">operate</span><span class="p">(</span><span class="n">equivsite</span><span class="o">.</span><span class="n">frac_coords</span><span class="p">),</span> <span class="n">equivsite</span><span class="o">.</span><span class="n">_lattice</span><span class="p">)</span>
                    <span class="c1"># if newsite.is_periodic_image(thissite):</span>
                    <span class="k">if</span> <span class="n">newsite</span><span class="o">.</span><span class="n">is_periodic_image</span><span class="p">(</span><span class="n">thissite</span><span class="p">,</span> <span class="n">tolerance</span><span class="o">=</span><span class="n">tolerance</span><span class="p">):</span>
                        <span class="n">mysym</span> <span class="o">=</span> <span class="n">symop</span>
                        <span class="n">dthissite2</span> <span class="o">=</span> <span class="n">thissite</span><span class="o">.</span><span class="n">frac_coords</span> <span class="o">-</span> <span class="n">newsite</span><span class="o">.</span><span class="n">frac_coords</span>
                        <span class="n">found</span> <span class="o">=</span> <span class="kc">True</span>
                        <span class="k">break</span>
            <span class="k">if</span> <span class="n">found</span><span class="p">:</span>
                <span class="k">break</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">found</span><span class="p">:</span>
            <span class="k">raise</span> <span class="n">EquivalentSiteSearchError</span><span class="p">(</span><span class="n">psite</span><span class="p">)</span>
        <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">sites_map</span><span class="p">[</span><span class="n">isite</span><span class="p">],</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span> <span class="o">+</span> <span class="n">dthissite2</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.get_site_neighbors"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.get_site_neighbors">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">get_site_neighbors</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Applies the strategy to the structure_environments object in order to get the neighbors of a given site.</span>
<span class="sd">        :param site: Site for which the neighbors are looked for</span>
<span class="sd">        :param structure_environments: StructureEnvironments object containing all the information needed to get the</span>
<span class="sd">            neighbors of the site</span>
<span class="sd">        :return: The list of neighbors of the site. For complex strategies, where one allows multiple solutions, this</span>
<span class="sd">            can return a list of list of neighbors</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">uniquely_determines_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Returns True if the strategy leads to a unique coordination environment, False otherwise.</span>
<span class="sd">        :return: True if the strategy leads to a unique coordination environment, False otherwise.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>

<div class="viewcode-block" id="AbstractChemenvStrategy.get_site_coordination_environment"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.get_site_coordination_environment">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">get_site_coordination_environment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Applies the strategy to the structure_environments object in order to define the coordination environment of</span>
<span class="sd">        a given site.</span>
<span class="sd">        :param site: Site for which the coordination environment is looked for</span>
<span class="sd">        :return: The coordination environment of the site. For complex strategies, where one allows multiple</span>
<span class="sd">            solutions, this can return a list of coordination environments for the site</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.get_site_coordination_environments"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.get_site_coordination_environments">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">get_site_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Applies the strategy to the structure_environments object in order to define the coordination environment of</span>
<span class="sd">        a given site.</span>
<span class="sd">        :param site: Site for which the coordination environment is looked for</span>
<span class="sd">        :return: The coordination environment of the site. For complex strategies, where one allows multiple</span>
<span class="sd">            solutions, this can return a list of coordination environments for the site</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.get_site_coordination_environments_fractions"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.get_site_coordination_environments_fractions">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">get_site_coordination_environments_fractions</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                                     <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ordered</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">min_fraction</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">return_maps</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                                                     <span class="n">return_strategy_dict_info</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Applies the strategy to the structure_environments object in order to define the coordination environment of</span>
<span class="sd">        a given site.</span>
<span class="sd">        :param site: Site for which the coordination environment is looked for</span>
<span class="sd">        :return: The coordination environment of the site. For complex strategies, where one allows multiple</span>
<span class="sd">            solutions, this can return a list of coordination environments for the site</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.get_site_ce_fractions_and_neighbors"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.get_site_ce_fractions_and_neighbors">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_ce_fractions_and_neighbors</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">full_ce_info</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">strategy_info</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Applies the strategy to the structure_environments object in order to get coordination environments, their</span>
<span class="sd">        fraction, csm, geometry_info, and neighbors</span>
<span class="sd">        :param site: Site for which the above information is seeked</span>
<span class="sd">        :return: The list of neighbors of the site. For complex strategies, where one allows multiple solutions, this</span>
<span class="sd">        can return a list of list of neighbors</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
        <span class="n">geoms_and_maps_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_site_coordination_environments_fractions</span><span class="p">(</span><span class="n">site</span><span class="o">=</span><span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                                                                                <span class="n">dequivsite</span><span class="o">=</span><span class="n">dequivsite</span><span class="p">,</span>
                                                                                <span class="n">dthissite</span><span class="o">=</span><span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="n">mysym</span><span class="p">,</span>
                                                                                <span class="n">return_maps</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                                                                                <span class="n">return_strategy_dict_info</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">geoms_and_maps_list</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>
        <span class="n">site_nbs_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="n">ce_and_neighbors</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="k">for</span> <span class="n">fractions_dict</span> <span class="ow">in</span> <span class="n">geoms_and_maps_list</span><span class="p">:</span>
            <span class="n">ce_map</span> <span class="o">=</span> <span class="n">fractions_dict</span><span class="p">[</span><span class="s1">&#39;ce_map&#39;</span><span class="p">]</span>
            <span class="n">ce_nb_set</span> <span class="o">=</span> <span class="n">site_nbs_sets</span><span class="p">[</span><span class="n">ce_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">ce_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span>
            <span class="n">neighbors</span> <span class="o">=</span> <span class="p">[{</span><span class="s1">&#39;site&#39;</span><span class="p">:</span> <span class="n">nb_site_and_index</span><span class="p">[</span><span class="s1">&#39;site&#39;</span><span class="p">],</span>
                          <span class="s1">&#39;index&#39;</span><span class="p">:</span> <span class="n">nb_site_and_index</span><span class="p">[</span><span class="s1">&#39;index&#39;</span><span class="p">]}</span>
                         <span class="k">for</span> <span class="n">nb_site_and_index</span> <span class="ow">in</span> <span class="n">ce_nb_set</span><span class="o">.</span><span class="n">neighb_sites_and_indices</span><span class="p">]</span>
            <span class="n">fractions_dict</span><span class="p">[</span><span class="s1">&#39;neighbors&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">neighbors</span>
            <span class="n">ce_and_neighbors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fractions_dict</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">ce_and_neighbors</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.set_option"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.set_option">[docs]</a>    <span class="k">def</span> <span class="nf">set_option</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">option_name</span><span class="p">,</span> <span class="n">option_value</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="fm">__setattr__</span><span class="p">(</span><span class="n">option_name</span><span class="p">,</span> <span class="n">option_value</span><span class="p">)</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.setup_options"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.setup_options">[docs]</a>    <span class="k">def</span> <span class="nf">setup_options</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">all_options_dict</span><span class="p">):</span>
        <span class="k">for</span> <span class="n">option_name</span><span class="p">,</span> <span class="n">option_value</span> <span class="ow">in</span> <span class="n">all_options_dict</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">set_option</span><span class="p">(</span><span class="n">option_name</span><span class="p">,</span> <span class="n">option_value</span><span class="p">)</span></div>

    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Equality method that should be implemented for any strategy</span>
<span class="sd">        :param other: strategy to be compared with the current one</span>
<span class="sd">        :return:</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>

    <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">out</span> <span class="o">=</span> <span class="s1">&#39;  Chemenv Strategy &quot;</span><span class="si">{}</span><span class="s1">&quot;</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">)</span>
        <span class="n">out</span> <span class="o">+=</span> <span class="s1">&#39;  </span><span class="si">{}</span><span class="se">\n\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="s1">&#39;=&#39;</span> <span class="o">*</span> <span class="p">(</span><span class="mi">19</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">)))</span>
        <span class="n">out</span> <span class="o">+=</span> <span class="s1">&#39;  Description :</span><span class="se">\n</span><span class="s1">  </span><span class="si">{}</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="s1">&#39;-&#39;</span> <span class="o">*</span> <span class="mi">13</span><span class="p">)</span>
        <span class="n">out</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">STRATEGY_DESCRIPTION</span>
        <span class="n">out</span> <span class="o">+=</span> <span class="s1">&#39;</span><span class="se">\n\n</span><span class="s1">&#39;</span>
        <span class="n">out</span> <span class="o">+=</span> <span class="s1">&#39;  Options :</span><span class="se">\n</span><span class="s1">  </span><span class="si">{}</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="s1">&#39;-&#39;</span> <span class="o">*</span> <span class="mi">9</span><span class="p">)</span>
        <span class="k">for</span> <span class="n">option_name</span><span class="p">,</span> <span class="n">option_dict</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">STRATEGY_OPTIONS</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
            <span class="n">out</span> <span class="o">+=</span> <span class="s1">&#39;   - </span><span class="si">{}</span><span class="s1"> : </span><span class="si">{}</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">option_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">option_name</span><span class="p">)))</span>
        <span class="k">return</span> <span class="n">out</span>

<div class="viewcode-block" id="AbstractChemenvStrategy.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.as_dict">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Bson-serializable dict representation of the SimplestChemenvStrategy object.</span>
<span class="sd">        :return: Bson-serializable dict representation of the SimplestChemenvStrategy object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div>

<div class="viewcode-block" id="AbstractChemenvStrategy.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AbstractChemenvStrategy.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Reconstructs the SimpleAbundanceChemenvStrategy object from a dict representation of the</span>
<span class="sd">        SimpleAbundanceChemenvStrategy object created using the as_dict method.</span>
<span class="sd">        :param d: dict representation of the SimpleAbundanceChemenvStrategy object</span>
<span class="sd">        :return: StructureEnvironments object</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div></div>


<div class="viewcode-block" id="SimplestChemenvStrategy"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimplestChemenvStrategy">[docs]</a><span class="k">class</span> <span class="nc">SimplestChemenvStrategy</span><span class="p">(</span><span class="n">AbstractChemenvStrategy</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Simplest ChemenvStrategy using fixed angle and distance parameters for the definition of neighbors in the</span>
<span class="sd">    Voronoi approach. The coordination environment is then given as the one with the lowest continuous symmetry measure</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="c1"># Default values for the distance and angle cutoffs</span>
    <span class="n">DEFAULT_DISTANCE_CUTOFF</span> <span class="o">=</span> <span class="mf">1.4</span>
    <span class="n">DEFAULT_ANGLE_CUTOFF</span> <span class="o">=</span> <span class="mf">0.3</span>
    <span class="n">DEFAULT_CONTINUOUS_SYMMETRY_MEASURE_CUTOFF</span> <span class="o">=</span> <span class="mf">10.0</span>
    <span class="n">DEFAULT_ADDITIONAL_CONDITION</span> <span class="o">=</span> <span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">AC</span><span class="o">.</span><span class="n">ONLY_ACB</span>
    <span class="n">STRATEGY_OPTIONS</span> <span class="o">=</span> <span class="n">OrderedDict</span><span class="p">()</span>  <span class="c1"># type: Dict[str, Dict]</span>
    <span class="n">STRATEGY_OPTIONS</span><span class="p">[</span><span class="s1">&#39;distance_cutoff&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="n">DistanceCutoffFloat</span><span class="p">,</span> <span class="s1">&#39;internal&#39;</span><span class="p">:</span> <span class="s1">&#39;_distance_cutoff&#39;</span><span class="p">,</span>
                                           <span class="s1">&#39;default&#39;</span><span class="p">:</span> <span class="n">DEFAULT_DISTANCE_CUTOFF</span><span class="p">}</span>
    <span class="n">STRATEGY_OPTIONS</span><span class="p">[</span><span class="s1">&#39;angle_cutoff&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="n">AngleCutoffFloat</span><span class="p">,</span> <span class="s1">&#39;internal&#39;</span><span class="p">:</span> <span class="s1">&#39;_angle_cutoff&#39;</span><span class="p">,</span>
                                        <span class="s1">&#39;default&#39;</span><span class="p">:</span> <span class="n">DEFAULT_ANGLE_CUTOFF</span><span class="p">}</span>
    <span class="n">STRATEGY_OPTIONS</span><span class="p">[</span><span class="s1">&#39;additional_condition&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="n">AdditionalConditionInt</span><span class="p">,</span>
                                                <span class="s1">&#39;internal&#39;</span><span class="p">:</span> <span class="s1">&#39;_additional_condition&#39;</span><span class="p">,</span>
                                                <span class="s1">&#39;default&#39;</span><span class="p">:</span> <span class="n">DEFAULT_ADDITIONAL_CONDITION</span><span class="p">}</span>
    <span class="n">STRATEGY_OPTIONS</span><span class="p">[</span><span class="s1">&#39;continuous_symmetry_measure_cutoff&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="n">CSMFloat</span><span class="p">,</span>
                                                              <span class="s1">&#39;internal&#39;</span><span class="p">:</span> <span class="s1">&#39;_continuous_symmetry_measure_cutoff&#39;</span><span class="p">,</span>
                                                              <span class="s1">&#39;default&#39;</span><span class="p">:</span> <span class="n">DEFAULT_CONTINUOUS_SYMMETRY_MEASURE_CUTOFF</span><span class="p">}</span>

    <span class="n">STRATEGY_DESCRIPTION</span> <span class="o">=</span> <span class="s1">&#39;    Simplest ChemenvStrategy using fixed angle and distance parameters </span><span class="se">\n</span><span class="s1">&#39;</span> \
                           <span class="s1">&#39;    for the definition of neighbors in the Voronoi approach. </span><span class="se">\n</span><span class="s1">&#39;</span> \
                           <span class="s1">&#39;    The coordination environment is then given as the one with the </span><span class="se">\n</span><span class="s1">&#39;</span> \
                           <span class="s1">&#39;    lowest continuous symmetry measure.&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">distance_cutoff</span><span class="o">=</span><span class="n">DEFAULT_DISTANCE_CUTOFF</span><span class="p">,</span>
                 <span class="n">angle_cutoff</span><span class="o">=</span><span class="n">DEFAULT_ANGLE_CUTOFF</span><span class="p">,</span> <span class="n">additional_condition</span><span class="o">=</span><span class="n">DEFAULT_ADDITIONAL_CONDITION</span><span class="p">,</span>
                 <span class="n">continuous_symmetry_measure_cutoff</span><span class="o">=</span><span class="n">DEFAULT_CONTINUOUS_SYMMETRY_MEASURE_CUTOFF</span><span class="p">,</span>
                 <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Constructor for this SimplestChemenvStrategy.</span>
<span class="sd">        :param distance_cutoff: Distance cutoff used</span>
<span class="sd">        :param angle_cutoff: Angle cutoff used</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">symmetry_measure_type</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">distance_cutoff</span> <span class="o">=</span> <span class="n">distance_cutoff</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">angle_cutoff</span> <span class="o">=</span> <span class="n">angle_cutoff</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">additional_condition</span> <span class="o">=</span> <span class="n">additional_condition</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">continuous_symmetry_measure_cutoff</span> <span class="o">=</span> <span class="n">continuous_symmetry_measure_cutoff</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">uniquely_determines_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="kc">True</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">distance_cutoff</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_distance_cutoff</span>

    <span class="nd">@distance_cutoff</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">distance_cutoff</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">distance_cutoff</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_distance_cutoff</span> <span class="o">=</span> <span class="n">DistanceCutoffFloat</span><span class="p">(</span><span class="n">distance_cutoff</span><span class="p">)</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">angle_cutoff</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_angle_cutoff</span>

    <span class="nd">@angle_cutoff</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">angle_cutoff</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">angle_cutoff</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_angle_cutoff</span> <span class="o">=</span> <span class="n">AngleCutoffFloat</span><span class="p">(</span><span class="n">angle_cutoff</span><span class="p">)</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">additional_condition</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span>

    <span class="nd">@additional_condition</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">additional_condition</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">additional_condition</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">=</span> <span class="n">AdditionalConditionInt</span><span class="p">(</span><span class="n">additional_condition</span><span class="p">)</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">continuous_symmetry_measure_cutoff</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_continuous_symmetry_measure_cutoff</span>

    <span class="nd">@continuous_symmetry_measure_cutoff</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">continuous_symmetry_measure_cutoff</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">continuous_symmetry_measure_cutoff</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_continuous_symmetry_measure_cutoff</span> <span class="o">=</span> <span class="n">CSMFloat</span><span class="p">(</span><span class="n">continuous_symmetry_measure_cutoff</span><span class="p">)</span>

<div class="viewcode-block" id="SimplestChemenvStrategy.get_site_neighbors"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimplestChemenvStrategy.get_site_neighbors">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_neighbors</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                           <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>  <span class="c1"># , neighbors_map=None):</span>
        <span class="c1"># if neighbors_map is not None:</span>
        <span class="c1">#    return self.structure_environments.voronoi.get_neighbors(isite=isite, neighbors_map=neighbors_map)</span>
        <span class="k">if</span> <span class="n">isite</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>

        <span class="n">ce</span><span class="p">,</span> <span class="n">cn_map</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_site_coordination_environment</span><span class="p">(</span><span class="n">site</span><span class="o">=</span><span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                                                            <span class="n">dequivsite</span><span class="o">=</span><span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="n">mysym</span><span class="p">,</span>
                                                            <span class="n">return_map</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

        <span class="n">nb_set</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span>
        <span class="n">eqsite_ps</span> <span class="o">=</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">neighb_sites</span>

        <span class="n">coordinated_neighbors</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="k">for</span> <span class="n">ips</span><span class="p">,</span> <span class="n">ps</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">eqsite_ps</span><span class="p">):</span>
            <span class="n">coords</span> <span class="o">=</span> <span class="n">mysym</span><span class="o">.</span><span class="n">operate</span><span class="p">(</span><span class="n">ps</span><span class="o">.</span><span class="n">frac_coords</span> <span class="o">+</span> <span class="n">dequivsite</span><span class="p">)</span> <span class="o">+</span> <span class="n">dthissite</span>
            <span class="n">ps_site</span> <span class="o">=</span> <span class="n">PeriodicSite</span><span class="p">(</span><span class="n">ps</span><span class="o">.</span><span class="n">_species</span><span class="p">,</span> <span class="n">coords</span><span class="p">,</span> <span class="n">ps</span><span class="o">.</span><span class="n">_lattice</span><span class="p">)</span>
            <span class="n">coordinated_neighbors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ps_site</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">coordinated_neighbors</span></div>

<div class="viewcode-block" id="SimplestChemenvStrategy.get_site_coordination_environment"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimplestChemenvStrategy.get_site_coordination_environment">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                          <span class="n">return_map</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">isite</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
        <span class="n">neighbors_normalized_distances</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">voronoi</span><span class="o">.</span><span class="n">neighbors_normalized_distances</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="n">neighbors_normalized_angles</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">voronoi</span><span class="o">.</span><span class="n">neighbors_normalized_angles</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="n">idist</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="k">for</span> <span class="n">iwd</span><span class="p">,</span> <span class="n">wd</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">neighbors_normalized_distances</span><span class="p">):</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">distance_cutoff</span> <span class="o">&gt;=</span> <span class="n">wd</span><span class="p">[</span><span class="s1">&#39;min&#39;</span><span class="p">]:</span>
                <span class="n">idist</span> <span class="o">=</span> <span class="n">iwd</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">break</span>
        <span class="n">iang</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="k">for</span> <span class="n">iwa</span><span class="p">,</span> <span class="n">wa</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">neighbors_normalized_angles</span><span class="p">):</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">angle_cutoff</span> <span class="o">&lt;=</span> <span class="n">wa</span><span class="p">[</span><span class="s1">&#39;max&#39;</span><span class="p">]:</span>
                <span class="n">iang</span> <span class="o">=</span> <span class="n">iwa</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">break</span>
        <span class="k">if</span> <span class="n">idist</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">iang</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Distance or angle parameter not found ...&#39;</span><span class="p">)</span>

        <span class="n">my_cn</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="n">my_inb_set</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="n">found</span> <span class="o">=</span> <span class="kc">False</span>
        <span class="k">for</span> <span class="n">cn</span><span class="p">,</span> <span class="n">nb_sets</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
            <span class="k">for</span> <span class="n">inb_set</span><span class="p">,</span> <span class="n">nb_set</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_sets</span><span class="p">):</span>
                <span class="n">sources</span> <span class="o">=</span> <span class="p">[</span><span class="n">src</span> <span class="k">for</span> <span class="n">src</span> <span class="ow">in</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">sources</span>
                           <span class="k">if</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;origin&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;dist_ang_ac_voronoi&#39;</span> <span class="ow">and</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;ac&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">additional_condition</span><span class="p">]</span>
                <span class="k">for</span> <span class="n">src</span> <span class="ow">in</span> <span class="n">sources</span><span class="p">:</span>
                    <span class="k">if</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;idp&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="n">idist</span> <span class="ow">and</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;iap&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="n">iang</span><span class="p">:</span>
                        <span class="n">my_cn</span> <span class="o">=</span> <span class="n">cn</span>
                        <span class="n">my_inb_set</span> <span class="o">=</span> <span class="n">inb_set</span>
                        <span class="n">found</span> <span class="o">=</span> <span class="kc">True</span>
                        <span class="k">break</span>
                <span class="k">if</span> <span class="n">found</span><span class="p">:</span>
                    <span class="k">break</span>
            <span class="k">if</span> <span class="n">found</span><span class="p">:</span>
                <span class="k">break</span>

        <span class="k">if</span> <span class="ow">not</span> <span class="n">found</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>

        <span class="n">cn_map</span> <span class="o">=</span> <span class="p">(</span><span class="n">my_cn</span><span class="p">,</span> <span class="n">my_inb_set</span><span class="p">)</span>
        <span class="n">ce</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">ce_list</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">sites_map</span><span class="p">[</span><span class="n">isite</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span>
        <span class="k">if</span> <span class="n">ce</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>
        <span class="n">coord_geoms</span> <span class="o">=</span> <span class="n">ce</span><span class="o">.</span><span class="n">coord_geoms</span>
        <span class="k">if</span> <span class="n">return_map</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">coord_geoms</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                <span class="k">return</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">cn_map</span>
            <span class="k">return</span> <span class="p">(</span><span class="n">ce</span><span class="o">.</span><span class="n">minimum_geometry</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">),</span> <span class="n">cn_map</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">coord_geoms</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                <span class="k">return</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">return</span> <span class="n">ce</span><span class="o">.</span><span class="n">minimum_geometry</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">)</span></div>

<div class="viewcode-block" id="SimplestChemenvStrategy.get_site_coordination_environments_fractions"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimplestChemenvStrategy.get_site_coordination_environments_fractions">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environments_fractions</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                                     <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ordered</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">min_fraction</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">return_maps</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                                                     <span class="n">return_strategy_dict_info</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">isite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">dequivsite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">dthissite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">mysym</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
        <span class="n">site_nb_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">site_nb_sets</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>
        <span class="n">ce_and_map</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_site_coordination_environment</span><span class="p">(</span><span class="n">site</span><span class="o">=</span><span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="n">dequivsite</span><span class="p">,</span>
                                                            <span class="n">dthissite</span><span class="o">=</span><span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="n">mysym</span><span class="p">,</span>
                                                            <span class="n">return_map</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">ce_and_map</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>
        <span class="n">ce</span><span class="p">,</span> <span class="n">ce_map</span> <span class="o">=</span> <span class="n">ce_and_map</span>
        <span class="k">if</span> <span class="n">ce</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">ce_dict</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;ce_symbol&#39;</span><span class="p">:</span> <span class="s1">&#39;UNKNOWN:</span><span class="si">{:d}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">ce_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="s1">&#39;ce_dict&#39;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> <span class="s1">&#39;ce_fraction&#39;</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">}</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">ce_dict</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;ce_symbol&#39;</span><span class="p">:</span> <span class="n">ce</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">&#39;ce_dict&#39;</span><span class="p">:</span> <span class="n">ce</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="s1">&#39;ce_fraction&#39;</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">}</span>
        <span class="k">if</span> <span class="n">return_maps</span><span class="p">:</span>
            <span class="n">ce_dict</span><span class="p">[</span><span class="s1">&#39;ce_map&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ce_map</span>
        <span class="k">if</span> <span class="n">return_strategy_dict_info</span><span class="p">:</span>
            <span class="n">ce_dict</span><span class="p">[</span><span class="s1">&#39;strategy_info&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="n">fractions_info_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">ce_dict</span><span class="p">]</span>
        <span class="k">return</span> <span class="n">fractions_info_list</span></div>

<div class="viewcode-block" id="SimplestChemenvStrategy.get_site_coordination_environments"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimplestChemenvStrategy.get_site_coordination_environments">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                           <span class="n">return_maps</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">get_site_coordination_environment</span><span class="p">(</span><span class="n">site</span><span class="o">=</span><span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="n">dequivsite</span><span class="p">,</span>
                                                       <span class="n">dthissite</span><span class="o">=</span><span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="n">mysym</span><span class="p">,</span> <span class="n">return_map</span><span class="o">=</span><span class="n">return_maps</span><span class="p">)]</span></div>

<div class="viewcode-block" id="SimplestChemenvStrategy.add_strategy_visualization_to_subplot"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimplestChemenvStrategy.add_strategy_visualization_to_subplot">[docs]</a>    <span class="k">def</span> <span class="nf">add_strategy_visualization_to_subplot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">subplot</span><span class="p">,</span> <span class="n">visualization_options</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">plot_type</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="n">subplot</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_distance_cutoff</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_angle_cutoff</span><span class="p">,</span> <span class="s1">&#39;o&#39;</span><span class="p">,</span> <span class="n">mec</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mfc</span><span class="o">=</span><span class="s1">&#39;w&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mi">12</span><span class="p">)</span>
        <span class="n">subplot</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_distance_cutoff</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_angle_cutoff</span><span class="p">,</span> <span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mi">12</span><span class="p">)</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_distance_cutoff</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">_distance_cutoff</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_angle_cutoff</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">_angle_cutoff</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_continuous_symmetry_measure_cutoff</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">_continuous_symmetry_measure_cutoff</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">)</span>

<div class="viewcode-block" id="SimplestChemenvStrategy.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimplestChemenvStrategy.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Bson-serializable dict representation of the SimplestChemenvStrategy object.</span>
<span class="sd">        :return: Bson-serializable dict representation of the SimplestChemenvStrategy object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;distance_cutoff&quot;</span><span class="p">:</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_distance_cutoff</span><span class="p">),</span>
                <span class="s2">&quot;angle_cutoff&quot;</span><span class="p">:</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_angle_cutoff</span><span class="p">),</span>
                <span class="s2">&quot;additional_condition&quot;</span><span class="p">:</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span><span class="p">),</span>
                <span class="s2">&quot;continuous_symmetry_measure_cutoff&quot;</span><span class="p">:</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_continuous_symmetry_measure_cutoff</span><span class="p">),</span>
                <span class="s2">&quot;symmetry_measure_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">}</span></div>

<div class="viewcode-block" id="SimplestChemenvStrategy.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimplestChemenvStrategy.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Reconstructs the SimplestChemenvStrategy object from a dict representation of the SimplestChemenvStrategy object</span>
<span class="sd">        created using the as_dict method.</span>
<span class="sd">        :param d: dict representation of the SimplestChemenvStrategy object</span>
<span class="sd">        :return: StructureEnvironments object</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">distance_cutoff</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;distance_cutoff&quot;</span><span class="p">],</span> <span class="n">angle_cutoff</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;angle_cutoff&quot;</span><span class="p">],</span>
                   <span class="n">additional_condition</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;additional_condition&quot;</span><span class="p">],</span>
                   <span class="n">continuous_symmetry_measure_cutoff</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;continuous_symmetry_measure_cutoff&quot;</span><span class="p">],</span>
                   <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;symmetry_measure_type&quot;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="SimpleAbundanceChemenvStrategy"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimpleAbundanceChemenvStrategy">[docs]</a><span class="k">class</span> <span class="nc">SimpleAbundanceChemenvStrategy</span><span class="p">(</span><span class="n">AbstractChemenvStrategy</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Simple ChemenvStrategy using the neighbors that are the most &quot;abundant&quot; in the grid of angle and distance</span>
<span class="sd">    parameters for the definition of neighbors in the Voronoi approach.</span>
<span class="sd">    The coordination environment is then given as the one with the lowest continuous symmetry measure</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="n">DEFAULT_MAX_DIST</span> <span class="o">=</span> <span class="mf">2.0</span>
    <span class="n">DEFAULT_ADDITIONAL_CONDITION</span> <span class="o">=</span> <span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">AC</span><span class="o">.</span><span class="n">ONLY_ACB</span>
    <span class="n">STRATEGY_OPTIONS</span> <span class="o">=</span> <span class="n">OrderedDict</span><span class="p">()</span>  <span class="c1"># type: Dict[str, Dict]</span>
    <span class="n">STRATEGY_OPTIONS</span><span class="p">[</span><span class="s1">&#39;additional_condition&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="n">AdditionalConditionInt</span><span class="p">,</span>
                                                <span class="s1">&#39;internal&#39;</span><span class="p">:</span> <span class="s1">&#39;_additional_condition&#39;</span><span class="p">,</span>
                                                <span class="s1">&#39;default&#39;</span><span class="p">:</span> <span class="n">DEFAULT_ADDITIONAL_CONDITION</span><span class="p">}</span>
    <span class="n">STRATEGY_OPTIONS</span><span class="p">[</span><span class="s1">&#39;surface_calculation_type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
    <span class="n">STRATEGY_DESCRIPTION</span> <span class="o">=</span> <span class="s1">&#39;    Simple Abundance ChemenvStrategy using the most &quot;abundant&quot; neighbors map </span><span class="se">\n</span><span class="s1">&#39;</span> \
                           <span class="s1">&#39;    for the definition of neighbors in the Voronoi approach. </span><span class="se">\n</span><span class="s1">&#39;</span> \
                           <span class="s1">&#39;    The coordination environment is then given as the one with the </span><span class="se">\n</span><span class="s1">&#39;</span> \
                           <span class="s1">&#39;    lowest continuous symmetry measure.&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">additional_condition</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">AC</span><span class="o">.</span><span class="n">ONLY_ACB</span><span class="p">,</span>
                 <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Constructor for the SimpleAbundanceChemenvStrategy.</span>
<span class="sd">        :param structure_environments: StructureEnvironments object containing all the information on the</span>
<span class="sd">            coordination of the sites in a structure</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s1">&#39;SimpleAbundanceChemenvStrategy not yet implemented&#39;</span><span class="p">)</span>
        <span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">symmetry_measure_type</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">=</span> <span class="n">additional_condition</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">uniquely_determines_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="kc">True</span>

<div class="viewcode-block" id="SimpleAbundanceChemenvStrategy.get_site_neighbors"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimpleAbundanceChemenvStrategy.get_site_neighbors">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_neighbors</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">):</span>
        <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
        <span class="n">cn_map</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_map</span><span class="p">(</span><span class="n">isite</span><span class="p">)</span>
        <span class="n">eqsite_ps</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">unique_coordinated_neighbors</span><span class="p">(</span><span class="n">isite</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">))</span>
        <span class="n">coordinated_neighbors</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="k">for</span> <span class="n">ips</span><span class="p">,</span> <span class="n">ps</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">eqsite_ps</span><span class="p">):</span>
            <span class="n">coords</span> <span class="o">=</span> <span class="n">mysym</span><span class="o">.</span><span class="n">operate</span><span class="p">(</span><span class="n">ps</span><span class="o">.</span><span class="n">frac_coords</span> <span class="o">+</span> <span class="n">dequivsite</span><span class="p">)</span> <span class="o">+</span> <span class="n">dthissite</span>
            <span class="n">ps_site</span> <span class="o">=</span> <span class="n">PeriodicSite</span><span class="p">(</span><span class="n">ps</span><span class="o">.</span><span class="n">_species</span><span class="p">,</span> <span class="n">coords</span><span class="p">,</span> <span class="n">ps</span><span class="o">.</span><span class="n">_lattice</span><span class="p">)</span>
            <span class="n">coordinated_neighbors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ps_site</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">coordinated_neighbors</span></div>

<div class="viewcode-block" id="SimpleAbundanceChemenvStrategy.get_site_coordination_environment"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimpleAbundanceChemenvStrategy.get_site_coordination_environment">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                          <span class="n">return_map</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">isite</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
        <span class="n">cn_map</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_map</span><span class="p">(</span><span class="n">isite</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">cn_map</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>
        <span class="n">coord_geoms</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">ce_list</span><span class="p">[</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">sites_map</span><span class="p">[</span><span class="n">isite</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span>
        <span class="k">if</span> <span class="n">return_map</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">coord_geoms</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                <span class="k">return</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">cn_map</span>
            <span class="k">return</span> <span class="n">coord_geoms</span><span class="o">.</span><span class="n">minimum_geometry</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">),</span> <span class="n">cn_map</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">coord_geoms</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                <span class="k">return</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">return</span> <span class="n">coord_geoms</span><span class="o">.</span><span class="n">minimum_geometry</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">)</span></div>

<div class="viewcode-block" id="SimpleAbundanceChemenvStrategy.get_site_coordination_environments"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimpleAbundanceChemenvStrategy.get_site_coordination_environments">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                           <span class="n">return_maps</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">get_site_coordination_environment</span><span class="p">(</span><span class="n">site</span><span class="o">=</span><span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="n">dequivsite</span><span class="p">,</span>
                                                       <span class="n">dthissite</span><span class="o">=</span><span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="n">mysym</span><span class="p">,</span> <span class="n">return_map</span><span class="o">=</span><span class="n">return_maps</span><span class="p">)]</span></div>

    <span class="k">def</span> <span class="nf">_get_map</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">isite</span><span class="p">):</span>
        <span class="n">maps_and_surfaces</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_maps_surfaces</span><span class="p">(</span><span class="n">isite</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">maps_and_surfaces</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>
        <span class="n">surface_max</span> <span class="o">=</span> <span class="mf">0.0</span>
        <span class="n">imax</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
        <span class="k">for</span> <span class="n">ii</span><span class="p">,</span> <span class="n">map_and_surface</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">maps_and_surfaces</span><span class="p">):</span>
            <span class="n">all_additional_conditions</span> <span class="o">=</span> <span class="p">[</span><span class="n">ac</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="k">for</span> <span class="n">ac</span> <span class="ow">in</span> <span class="n">map_and_surface</span><span class="p">[</span><span class="s1">&#39;parameters_indices&#39;</span><span class="p">]]</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="ow">in</span> <span class="n">all_additional_conditions</span> <span class="ow">and</span> <span class="n">map_and_surface</span><span class="p">[</span><span class="s1">&#39;surface&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="n">surface_max</span><span class="p">:</span>
                <span class="n">surface_max</span> <span class="o">=</span> <span class="n">map_and_surface</span><span class="p">[</span><span class="s1">&#39;surface&#39;</span><span class="p">]</span>
                <span class="n">imax</span> <span class="o">=</span> <span class="n">ii</span>
        <span class="k">return</span> <span class="n">maps_and_surfaces</span><span class="p">[</span><span class="n">imax</span><span class="p">][</span><span class="s1">&#39;map&#39;</span><span class="p">]</span>

    <span class="k">def</span> <span class="nf">_get_maps_surfaces</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">isite</span><span class="p">,</span> <span class="n">surface_calculation_type</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">surface_calculation_type</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">surface_calculation_type</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;distance_parameter&#39;</span><span class="p">:</span> <span class="p">(</span><span class="s1">&#39;initial_normalized&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">),</span>
                                        <span class="s1">&#39;angle_parameter&#39;</span><span class="p">:</span> <span class="p">(</span><span class="s1">&#39;initial_normalized&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)}</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">voronoi</span><span class="o">.</span><span class="n">maps_and_surfaces</span><span class="p">(</span><span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                                                                     <span class="n">surface_calculation_type</span><span class="o">=</span><span class="n">surface_calculation_type</span><span class="p">,</span>
                                                                     <span class="n">max_dist</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">DEFAULT_MAX_DIST</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">additional_condition</span><span class="p">)</span>

<div class="viewcode-block" id="SimpleAbundanceChemenvStrategy.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimpleAbundanceChemenvStrategy.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Bson-serializable dict representation of the SimpleAbundanceChemenvStrategy object.</span>
<span class="sd">        :return: Bson-serializable dict representation of the SimpleAbundanceChemenvStrategy object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;additional_condition&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span><span class="p">}</span></div>

<div class="viewcode-block" id="SimpleAbundanceChemenvStrategy.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SimpleAbundanceChemenvStrategy.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Reconstructs the SimpleAbundanceChemenvStrategy object from a dict representation of the</span>
<span class="sd">        SimpleAbundanceChemenvStrategy object created using the as_dict method.</span>
<span class="sd">        :param d: dict representation of the SimpleAbundanceChemenvStrategy object</span>
<span class="sd">        :return: StructureEnvironments object</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">additional_condition</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;additional_condition&quot;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="TargettedPenaltiedAbundanceChemenvStrategy"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.TargettedPenaltiedAbundanceChemenvStrategy">[docs]</a><span class="k">class</span> <span class="nc">TargettedPenaltiedAbundanceChemenvStrategy</span><span class="p">(</span><span class="n">SimpleAbundanceChemenvStrategy</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Simple ChemenvStrategy using the neighbors that are the most &quot;abundant&quot; in the grid of angle and distance</span>
<span class="sd">    parameters for the definition of neighbors in the Voronoi approach, with a bias for a given list of target</span>
<span class="sd">    environments. This can be useful in the case of, e.g. connectivity search of some given environment.</span>
<span class="sd">    The coordination environment is then given as the one with the lowest continuous symmetry measure</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">DEFAULT_TARGET_ENVIRONMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;O:6&#39;</span><span class="p">]</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">truncate_dist_ang</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                 <span class="n">additional_condition</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">AC</span><span class="o">.</span><span class="n">ONLY_ACB</span><span class="p">,</span>
                 <span class="n">max_nabundant</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">target_environments</span><span class="o">=</span><span class="n">DEFAULT_TARGET_ENVIRONMENTS</span><span class="p">,</span> <span class="n">target_penalty_type</span><span class="o">=</span><span class="s1">&#39;max_csm&#39;</span><span class="p">,</span>
                 <span class="n">max_csm</span><span class="o">=</span><span class="mf">5.0</span><span class="p">,</span> <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span><span class="p">):</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s1">&#39;TargettedPenaltiedAbundanceChemenvStrategy not yet implemented&#39;</span><span class="p">)</span>
        <span class="n">SimpleAbundanceChemenvStrategy</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span>
                                                <span class="n">additional_condition</span><span class="o">=</span><span class="n">additional_condition</span><span class="p">,</span>
                                                <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">symmetry_measure_type</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_nabundant</span> <span class="o">=</span> <span class="n">max_nabundant</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">target_environments</span> <span class="o">=</span> <span class="n">target_environments</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">target_penalty_type</span> <span class="o">=</span> <span class="n">target_penalty_type</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_csm</span> <span class="o">=</span> <span class="n">max_csm</span>

<div class="viewcode-block" id="TargettedPenaltiedAbundanceChemenvStrategy.get_site_coordination_environment"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.TargettedPenaltiedAbundanceChemenvStrategy.get_site_coordination_environment">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                          <span class="n">return_map</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">isite</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
        <span class="n">cn_map</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_map</span><span class="p">(</span><span class="n">isite</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">cn_map</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>
        <span class="n">chemical_environments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">ce_list</span><span class="p">[</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">sites_map</span><span class="p">[</span><span class="n">isite</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span>
        <span class="k">if</span> <span class="n">return_map</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">chemical_environments</span><span class="o">.</span><span class="n">coord_geoms</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">chemical_environments</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                <span class="k">return</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">cn_map</span>
            <span class="k">return</span> <span class="n">chemical_environments</span><span class="o">.</span><span class="n">minimum_geometry</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">),</span> <span class="n">cn_map</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">chemical_environments</span><span class="o">.</span><span class="n">coord_geoms</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                <span class="k">return</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">return</span> <span class="n">chemical_environments</span><span class="o">.</span><span class="n">minimum_geometry</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">)</span></div>

    <span class="k">def</span> <span class="nf">_get_map</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">isite</span><span class="p">):</span>
        <span class="n">maps_and_surfaces</span> <span class="o">=</span> <span class="n">SimpleAbundanceChemenvStrategy</span><span class="o">.</span><span class="n">_get_maps_surfaces</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">isite</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">maps_and_surfaces</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">SimpleAbundanceChemenvStrategy</span><span class="o">.</span><span class="n">_get_map</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">isite</span><span class="p">)</span>
        <span class="n">current_map</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="n">current_target_env_csm</span> <span class="o">=</span> <span class="mf">100.0</span>
        <span class="n">surfaces</span> <span class="o">=</span> <span class="p">[</span><span class="n">map_and_surface</span><span class="p">[</span><span class="s1">&#39;surface&#39;</span><span class="p">]</span> <span class="k">for</span> <span class="n">map_and_surface</span> <span class="ow">in</span> <span class="n">maps_and_surfaces</span><span class="p">]</span>
        <span class="n">order</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">argsort</span><span class="p">(</span><span class="n">surfaces</span><span class="p">)[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
        <span class="n">target_cgs</span> <span class="o">=</span> <span class="p">[</span><span class="n">AllCoordinationGeometries</span><span class="p">()</span><span class="o">.</span><span class="n">get_geometry_from_mp_symbol</span><span class="p">(</span><span class="n">mp_symbol</span><span class="p">)</span>
                      <span class="k">for</span> <span class="n">mp_symbol</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_environments</span><span class="p">]</span>
        <span class="n">target_cns</span> <span class="o">=</span> <span class="p">[</span><span class="n">cg</span><span class="o">.</span><span class="n">coordination_number</span> <span class="k">for</span> <span class="n">cg</span> <span class="ow">in</span> <span class="n">target_cgs</span><span class="p">]</span>
        <span class="k">for</span> <span class="n">ii</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">min</span><span class="p">([</span><span class="nb">len</span><span class="p">(</span><span class="n">maps_and_surfaces</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_nabundant</span><span class="p">])):</span>
            <span class="n">my_map_and_surface</span> <span class="o">=</span> <span class="n">maps_and_surfaces</span><span class="p">[</span><span class="n">order</span><span class="p">[</span><span class="n">ii</span><span class="p">]]</span>
            <span class="n">mymap</span> <span class="o">=</span> <span class="n">my_map_and_surface</span><span class="p">[</span><span class="s1">&#39;map&#39;</span><span class="p">]</span>
            <span class="n">cn</span> <span class="o">=</span> <span class="n">mymap</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">cn</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">target_cns</span> <span class="ow">or</span> <span class="n">cn</span> <span class="o">&gt;</span> <span class="mi">12</span> <span class="ow">or</span> <span class="n">cn</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                <span class="k">continue</span>
            <span class="n">all_conditions</span> <span class="o">=</span> <span class="p">[</span><span class="n">params</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="k">for</span> <span class="n">params</span> <span class="ow">in</span> <span class="n">my_map_and_surface</span><span class="p">[</span><span class="s1">&#39;parameters_indices&#39;</span><span class="p">]]</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">all_conditions</span><span class="p">:</span>
                <span class="k">continue</span>
            <span class="n">cg</span><span class="p">,</span> <span class="n">cgdict</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">ce_list</span>
                          <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">sites_map</span><span class="p">[</span><span class="n">isite</span><span class="p">]]</span>
                          <span class="p">[</span><span class="n">mymap</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">mymap</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span><span class="o">.</span><span class="n">minimum_geometry</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">))</span>
            <span class="k">if</span> <span class="p">(</span><span class="n">cg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_environments</span> <span class="ow">and</span> <span class="n">cgdict</span><span class="p">[</span><span class="s1">&#39;symmetry_measure&#39;</span><span class="p">]</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_csm</span> <span class="ow">and</span>
                    <span class="n">cgdict</span><span class="p">[</span><span class="s1">&#39;symmetry_measure&#39;</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">current_target_env_csm</span><span class="p">):</span>
                <span class="n">current_map</span> <span class="o">=</span> <span class="n">mymap</span>
                <span class="n">current_target_env_csm</span> <span class="o">=</span> <span class="n">cgdict</span><span class="p">[</span><span class="s1">&#39;symmetry_measure&#39;</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">current_map</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">current_map</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">SimpleAbundanceChemenvStrategy</span><span class="o">.</span><span class="n">_get_map</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">isite</span><span class="p">)</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">uniquely_determines_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="kc">True</span>

<div class="viewcode-block" id="TargettedPenaltiedAbundanceChemenvStrategy.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.TargettedPenaltiedAbundanceChemenvStrategy.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Bson-serializable dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object.</span>
<span class="sd">        :return: Bson-serializable dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;additional_condition&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span><span class="p">,</span>
                <span class="s2">&quot;max_nabundant&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_nabundant</span><span class="p">,</span>
                <span class="s2">&quot;target_environments&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_environments</span><span class="p">,</span>
                <span class="s2">&quot;target_penalty_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_penalty_type</span><span class="p">,</span>
                <span class="s2">&quot;max_csm&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_csm</span><span class="p">}</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">additional_condition</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">max_nabundant</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">max_nabundant</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">target_environments</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">target_environments</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">target_penalty_type</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">target_penalty_type</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">max_csm</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">max_csm</span><span class="p">)</span>

<div class="viewcode-block" id="TargettedPenaltiedAbundanceChemenvStrategy.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.TargettedPenaltiedAbundanceChemenvStrategy.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Reconstructs the TargettedPenaltiedAbundanceChemenvStrategy object from a dict representation of the</span>
<span class="sd">        TargettedPenaltiedAbundanceChemenvStrategy object created using the as_dict method.</span>
<span class="sd">        :param d: dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object</span>
<span class="sd">        :return: TargettedPenaltiedAbundanceChemenvStrategy object</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">additional_condition</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;additional_condition&quot;</span><span class="p">],</span>
                   <span class="n">max_nabundant</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;max_nabundant&quot;</span><span class="p">],</span>
                   <span class="n">target_environments</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;target_environments&quot;</span><span class="p">],</span>
                   <span class="n">target_penalty_type</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;target_penalty_type&quot;</span><span class="p">],</span>
                   <span class="n">max_csm</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;max_csm&quot;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="NbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">NbSetWeight</span><span class="p">(</span><span class="n">MSONable</span><span class="p">,</span> <span class="n">metaclass</span><span class="o">=</span><span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span><span class="p">):</span>

<div class="viewcode-block" id="NbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NbSetWeight.as_dict">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        A JSON serializable dict representation of this neighbors set weight.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">pass</span></div>

<div class="viewcode-block" id="NbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NbSetWeight.weight">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">pass</span></div></div>


<div class="viewcode-block" id="AngleNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">AngleNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;AngleWeight&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">aa</span><span class="o">=</span><span class="mf">1.0</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">=</span> <span class="n">aa</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">==</span> <span class="mf">1.0</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">aw</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">angle_sum</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">aw</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">angle_sumn</span>

<div class="viewcode-block" id="AngleNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">aw</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">)</span></div>

<div class="viewcode-block" id="AngleNbSetWeight.angle_sum"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleNbSetWeight.angle_sum">[docs]</a>    <span class="k">def</span> <span class="nf">angle_sum</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">angles</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="mf">4.0</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">)</span></div>

<div class="viewcode-block" id="AngleNbSetWeight.angle_sumn"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleNbSetWeight.angle_sumn">[docs]</a>    <span class="k">def</span> <span class="nf">angle_sumn</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">power</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">angle_sum</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span><span class="p">)</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">aa</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="AngleNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;aa&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="AngleNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AngleNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">aa</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;aa&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">NormalizedAngleDistanceNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;NormAngleDistWeight&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">average_type</span><span class="p">,</span> <span class="n">aa</span><span class="p">,</span> <span class="n">bb</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">average_type</span> <span class="o">=</span> <span class="n">average_type</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">average_type</span> <span class="o">==</span> <span class="s1">&#39;geometric&#39;</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">eval</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">gweight</span>
        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">average_type</span> <span class="o">==</span> <span class="s1">&#39;arithmetic&#39;</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">eval</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aweight</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Average type is &quot;</span><span class="si">{}</span><span class="s1">&quot; while it should be &#39;</span>
                             <span class="s1">&#39;&quot;geometric&quot; or &quot;arithmetic&quot;&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">average_type</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">=</span> <span class="n">aa</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="o">=</span> <span class="n">bb</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">fda</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">invdist</span>
            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Both exponents are 0.&#39;</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">fda</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">invndist</span>
        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">fda</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ang</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">fda</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">angn</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">fda</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">anginvdist</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">fda</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">anginvndist</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">fda</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">angninvdist</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">fda</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">angninvndist</span>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">average_type</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">average_type</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">aa</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">bb</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;average_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">average_type</span><span class="p">,</span>
                <span class="s2">&quot;aa&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span><span class="p">,</span>
                <span class="s2">&quot;bb&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">average_type</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;average_type&#39;</span><span class="p">],</span> <span class="n">aa</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;aa&#39;</span><span class="p">],</span> <span class="n">bb</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;bb&#39;</span><span class="p">])</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.invdist"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.invdist">[docs]</a>    <span class="k">def</span> <span class="nf">invdist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">[</span><span class="mf">1.0</span> <span class="o">/</span> <span class="n">dist</span> <span class="k">for</span> <span class="n">dist</span> <span class="ow">in</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_distances</span><span class="p">]</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.invndist"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.invndist">[docs]</a>    <span class="k">def</span> <span class="nf">invndist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">[</span><span class="mf">1.0</span> <span class="o">/</span> <span class="n">dist</span> <span class="o">**</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="k">for</span> <span class="n">dist</span> <span class="ow">in</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_distances</span><span class="p">]</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.ang"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.ang">[docs]</a>    <span class="k">def</span> <span class="nf">ang</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_angles</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.angn"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.angn">[docs]</a>    <span class="k">def</span> <span class="nf">angn</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">[</span><span class="n">ang</span> <span class="o">**</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="k">for</span> <span class="n">ang</span> <span class="ow">in</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_angles</span><span class="p">]</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.anginvdist"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.anginvdist">[docs]</a>    <span class="k">def</span> <span class="nf">anginvdist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="n">nangles</span> <span class="o">=</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_angles</span>
        <span class="k">return</span> <span class="p">[</span><span class="n">nangles</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span> <span class="o">/</span> <span class="n">dist</span> <span class="k">for</span> <span class="n">ii</span><span class="p">,</span> <span class="n">dist</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_distances</span><span class="p">)]</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.anginvndist"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.anginvndist">[docs]</a>    <span class="k">def</span> <span class="nf">anginvndist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="n">nangles</span> <span class="o">=</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_angles</span>
        <span class="k">return</span> <span class="p">[</span><span class="n">nangles</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span> <span class="o">/</span> <span class="n">dist</span> <span class="o">**</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="k">for</span> <span class="n">ii</span><span class="p">,</span> <span class="n">dist</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_distances</span><span class="p">)]</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.angninvdist"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.angninvdist">[docs]</a>    <span class="k">def</span> <span class="nf">angninvdist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="n">nangles</span> <span class="o">=</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_angles</span>
        <span class="k">return</span> <span class="p">[</span><span class="n">nangles</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span> <span class="o">**</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">/</span> <span class="n">dist</span> <span class="k">for</span> <span class="n">ii</span><span class="p">,</span> <span class="n">dist</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_distances</span><span class="p">)]</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.angninvndist"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.angninvndist">[docs]</a>    <span class="k">def</span> <span class="nf">angninvndist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">):</span>
        <span class="n">nangles</span> <span class="o">=</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_angles</span>
        <span class="k">return</span> <span class="p">[</span><span class="n">nangles</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span> <span class="o">**</span> <span class="bp">self</span><span class="o">.</span><span class="n">aa</span> <span class="o">/</span> <span class="n">dist</span> <span class="o">**</span> <span class="bp">self</span><span class="o">.</span><span class="n">bb</span> <span class="k">for</span> <span class="n">ii</span><span class="p">,</span> <span class="n">dist</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_distances</span><span class="p">)]</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="n">fda_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fda</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">)</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">fda_list</span><span class="o">=</span><span class="n">fda_list</span><span class="p">)</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.gweight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.gweight">[docs]</a>    <span class="k">def</span> <span class="nf">gweight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fda_list</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">gmean</span><span class="p">(</span><span class="n">fda_list</span><span class="p">)</span></div>

<div class="viewcode-block" id="NormalizedAngleDistanceNbSetWeight.aweight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.NormalizedAngleDistanceNbSetWeight.aweight">[docs]</a>    <span class="k">def</span> <span class="nf">aweight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fda_list</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">fda_list</span><span class="p">)</span></div></div>


<div class="viewcode-block" id="get_effective_csm"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.get_effective_csm">[docs]</a><span class="k">def</span> <span class="nf">get_effective_csm</span><span class="p">(</span><span class="n">nb_set</span><span class="p">,</span> <span class="n">cn_map</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">additional_info</span><span class="p">,</span>
                      <span class="n">symmetry_measure_type</span><span class="p">,</span> <span class="n">max_effective_csm</span><span class="p">,</span> <span class="n">effective_csm_estimator_ratio_function</span><span class="p">):</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="n">effective_csm</span> <span class="o">=</span> <span class="n">additional_info</span><span class="p">[</span><span class="s1">&#39;effective_csms&#39;</span><span class="p">][</span><span class="n">nb_set</span><span class="o">.</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">]</span>
    <span class="k">except</span> <span class="ne">KeyError</span><span class="p">:</span>
        <span class="n">site_ce_list</span> <span class="o">=</span> <span class="n">structure_environments</span><span class="o">.</span><span class="n">ce_list</span><span class="p">[</span><span class="n">nb_set</span><span class="o">.</span><span class="n">isite</span><span class="p">]</span>
        <span class="n">site_chemenv</span> <span class="o">=</span> <span class="n">site_ce_list</span><span class="p">[</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span>
        <span class="k">if</span> <span class="n">site_chemenv</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">effective_csm</span> <span class="o">=</span> <span class="mf">100.0</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">mingeoms</span> <span class="o">=</span> <span class="n">site_chemenv</span><span class="o">.</span><span class="n">minimum_geometries</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">symmetry_measure_type</span><span class="p">,</span>
                                                       <span class="n">max_csm</span><span class="o">=</span><span class="n">max_effective_csm</span><span class="p">)</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mingeoms</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                <span class="n">effective_csm</span> <span class="o">=</span> <span class="mf">100.0</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">csms</span> <span class="o">=</span> <span class="p">[</span><span class="n">ce_dict</span><span class="p">[</span><span class="s1">&#39;other_symmetry_measures&#39;</span><span class="p">][</span><span class="n">symmetry_measure_type</span><span class="p">]</span> <span class="k">for</span> <span class="n">mp_symbol</span><span class="p">,</span> <span class="n">ce_dict</span> <span class="ow">in</span> <span class="n">mingeoms</span>
                        <span class="k">if</span> <span class="n">ce_dict</span><span class="p">[</span><span class="s1">&#39;other_symmetry_measures&#39;</span><span class="p">][</span><span class="n">symmetry_measure_type</span><span class="p">]</span> <span class="o">&lt;=</span> <span class="n">max_effective_csm</span><span class="p">]</span>
                <span class="n">effective_csm</span> <span class="o">=</span> <span class="n">effective_csm_estimator_ratio_function</span><span class="o">.</span><span class="n">mean_estimator</span><span class="p">(</span><span class="n">csms</span><span class="p">)</span>
        <span class="n">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">&#39;effective_csms&#39;</span><span class="p">,</span>
                 <span class="n">isite</span><span class="o">=</span><span class="n">nb_set</span><span class="o">.</span><span class="n">isite</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">effective_csm</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">effective_csm</span></div>


<div class="viewcode-block" id="set_info"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.set_info">[docs]</a><span class="k">def</span> <span class="nf">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="p">,</span> <span class="n">isite</span><span class="p">,</span> <span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="n">additional_info</span><span class="p">[</span><span class="n">field</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
    <span class="k">except</span> <span class="ne">KeyError</span><span class="p">:</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">additional_info</span><span class="p">[</span><span class="n">field</span><span class="p">][</span><span class="n">isite</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="n">cn_map</span><span class="p">:</span> <span class="n">value</span><span class="p">}</span>
        <span class="k">except</span> <span class="ne">KeyError</span><span class="p">:</span>
            <span class="n">additional_info</span><span class="p">[</span><span class="n">field</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="n">isite</span><span class="p">:</span> <span class="p">{</span><span class="n">cn_map</span><span class="p">:</span> <span class="n">value</span><span class="p">}}</span></div>


<div class="viewcode-block" id="SelfCSMNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SelfCSMNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">SelfCSMNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;SelfCSMWeight&#39;</span>

    <span class="n">DEFAULT_EFFECTIVE_CSM_ESTIMATOR</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;power2_inverse_decreasing&#39;</span><span class="p">,</span>
                                       <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;max_csm&#39;</span><span class="p">:</span> <span class="mf">8.0</span><span class="p">}}</span>
    <span class="n">DEFAULT_WEIGHT_ESTIMATOR</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;power2_decreasing_exp&#39;</span><span class="p">,</span>
                                <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;max_csm&#39;</span><span class="p">:</span> <span class="mf">8.0</span><span class="p">,</span>
                                            <span class="s1">&#39;alpha&#39;</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">}}</span>
    <span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span> <span class="o">=</span> <span class="s1">&#39;csm_wcs_ctwcc&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">effective_csm_estimator</span><span class="o">=</span><span class="n">DEFAULT_EFFECTIVE_CSM_ESTIMATOR</span><span class="p">,</span>
                 <span class="n">weight_estimator</span><span class="o">=</span><span class="n">DEFAULT_WEIGHT_ESTIMATOR</span><span class="p">,</span>
                 <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator</span> <span class="o">=</span> <span class="n">effective_csm_estimator</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator_rf</span> <span class="o">=</span> <span class="n">CSMInfiniteRatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">effective_csm_estimator</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator</span> <span class="o">=</span> <span class="n">weight_estimator</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator_rf</span> <span class="o">=</span> <span class="n">CSMFiniteRatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">weight_estimator</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="o">=</span> <span class="n">symmetry_measure_type</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_effective_csm</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator</span><span class="p">[</span><span class="s1">&#39;options&#39;</span><span class="p">][</span><span class="s1">&#39;max_csm&#39;</span><span class="p">]</span>

<div class="viewcode-block" id="SelfCSMNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SelfCSMNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="n">effective_csm</span> <span class="o">=</span> <span class="n">get_effective_csm</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span>
                                          <span class="n">structure_environments</span><span class="o">=</span><span class="n">structure_environments</span><span class="p">,</span>
                                          <span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span>
                                          <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">,</span>
                                          <span class="n">max_effective_csm</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">max_effective_csm</span><span class="p">,</span>
                                          <span class="n">effective_csm_estimator_ratio_function</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator_rf</span><span class="p">)</span>
        <span class="n">weight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator_rf</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="n">effective_csm</span><span class="p">)</span>
        <span class="n">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">&#39;self_csms_weights&#39;</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">nb_set</span><span class="o">.</span><span class="n">isite</span><span class="p">,</span>
                 <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">weight</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">weight</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">effective_csm_estimator</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">weight_estimator</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="SelfCSMNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SelfCSMNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;effective_csm_estimator&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator</span><span class="p">,</span>
                <span class="s2">&quot;weight_estimator&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator</span><span class="p">,</span>
                <span class="s2">&quot;symmetry_measure_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="SelfCSMNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.SelfCSMNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">effective_csm_estimator</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;effective_csm_estimator&#39;</span><span class="p">],</span>
                   <span class="n">weight_estimator</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_estimator&#39;</span><span class="p">],</span>
                   <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;symmetry_measure_type&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="DeltaCSMNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaCSMNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">DeltaCSMNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;DeltaCSMWeight&#39;</span>

    <span class="n">DEFAULT_EFFECTIVE_CSM_ESTIMATOR</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;power2_inverse_decreasing&#39;</span><span class="p">,</span>
                                       <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;max_csm&#39;</span><span class="p">:</span> <span class="mf">8.0</span><span class="p">}}</span>
    <span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span> <span class="o">=</span> <span class="s1">&#39;csm_wcs_ctwcc&#39;</span>
    <span class="n">DEFAULT_WEIGHT_ESTIMATOR</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;smootherstep&#39;</span><span class="p">,</span>
                                <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;delta_csm_min&#39;</span><span class="p">:</span> <span class="mf">0.5</span><span class="p">,</span>
                                            <span class="s1">&#39;delta_csm_max&#39;</span><span class="p">:</span> <span class="mf">3.0</span><span class="p">}}</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">effective_csm_estimator</span><span class="o">=</span><span class="n">DEFAULT_EFFECTIVE_CSM_ESTIMATOR</span><span class="p">,</span>
                 <span class="n">weight_estimator</span><span class="o">=</span><span class="n">DEFAULT_WEIGHT_ESTIMATOR</span><span class="p">,</span>
                 <span class="n">delta_cn_weight_estimators</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator</span> <span class="o">=</span> <span class="n">effective_csm_estimator</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator_rf</span> <span class="o">=</span> <span class="n">CSMInfiniteRatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">effective_csm_estimator</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator</span> <span class="o">=</span> <span class="n">weight_estimator</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator_rf</span> <span class="o">=</span> <span class="n">DeltaCSMRatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">weight_estimator</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">delta_cn_weight_estimators</span> <span class="o">=</span> <span class="n">delta_cn_weight_estimators</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">delta_cn_weight_estimators_rfs</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="k">if</span> <span class="n">delta_cn_weight_estimators</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">for</span> <span class="n">delta_cn</span><span class="p">,</span> <span class="n">dcn_w_estimator</span> <span class="ow">in</span> <span class="n">delta_cn_weight_estimators</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">delta_cn_weight_estimators_rfs</span><span class="p">[</span><span class="n">delta_cn</span><span class="p">]</span> <span class="o">=</span> <span class="n">DeltaCSMRatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">dcn_w_estimator</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="o">=</span> <span class="n">symmetry_measure_type</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_effective_csm</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator</span><span class="p">[</span><span class="s1">&#39;options&#39;</span><span class="p">][</span><span class="s1">&#39;max_csm&#39;</span><span class="p">]</span>

<div class="viewcode-block" id="DeltaCSMNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaCSMNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="n">effcsm</span> <span class="o">=</span> <span class="n">get_effective_csm</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span>
                                   <span class="n">structure_environments</span><span class="o">=</span><span class="n">structure_environments</span><span class="p">,</span>
                                   <span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span>
                                   <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">,</span>
                                   <span class="n">max_effective_csm</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">max_effective_csm</span><span class="p">,</span>
                                   <span class="n">effective_csm_estimator_ratio_function</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator_rf</span><span class="p">)</span>
        <span class="n">cn</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
        <span class="n">inb_set</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
        <span class="n">isite</span> <span class="o">=</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">isite</span>
        <span class="n">delta_csm</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="n">delta_csm_cn_map2</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="n">nb_set_weight</span> <span class="o">=</span> <span class="mf">1.0</span>
        <span class="k">for</span> <span class="n">cn2</span><span class="p">,</span> <span class="n">nb_sets</span> <span class="ow">in</span> <span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">cn2</span> <span class="o">&lt;</span> <span class="n">cn</span><span class="p">:</span>
                <span class="k">continue</span>
            <span class="k">for</span> <span class="n">inb_set2</span><span class="p">,</span> <span class="n">nb_set2</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_sets</span><span class="p">):</span>
                <span class="k">if</span> <span class="n">cn</span> <span class="o">==</span> <span class="n">cn2</span> <span class="ow">and</span> <span class="n">inb_set</span> <span class="o">==</span> <span class="n">inb_set</span><span class="p">:</span>
                    <span class="k">continue</span>
                <span class="n">effcsm2</span> <span class="o">=</span> <span class="n">get_effective_csm</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set2</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="p">(</span><span class="n">cn2</span><span class="p">,</span> <span class="n">inb_set2</span><span class="p">),</span>
                                            <span class="n">structure_environments</span><span class="o">=</span><span class="n">structure_environments</span><span class="p">,</span>
                                            <span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span>
                                            <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">,</span>
                                            <span class="n">max_effective_csm</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">max_effective_csm</span><span class="p">,</span>
                                            <span class="n">effective_csm_estimator_ratio_function</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator_rf</span><span class="p">)</span>
                <span class="n">this_delta_csm</span> <span class="o">=</span> <span class="n">effcsm2</span> <span class="o">-</span> <span class="n">effcsm</span>
                <span class="k">if</span> <span class="n">cn2</span> <span class="o">==</span> <span class="n">cn</span><span class="p">:</span>
                    <span class="k">if</span> <span class="n">this_delta_csm</span> <span class="o">&lt;</span> <span class="mf">0.0</span><span class="p">:</span>
                        <span class="n">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">&#39;delta_csms&#39;</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                                 <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">this_delta_csm</span><span class="p">)</span>
                        <span class="n">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">&#39;delta_csms_weights&#39;</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                                 <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="mf">0.0</span><span class="p">)</span>
                        <span class="n">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">&#39;delta_csms_cn_map2&#39;</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                                 <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="p">(</span><span class="n">cn2</span><span class="p">,</span> <span class="n">inb_set2</span><span class="p">))</span>
                        <span class="k">return</span> <span class="mf">0.0</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">dcn</span> <span class="o">=</span> <span class="n">cn2</span> <span class="o">-</span> <span class="n">cn</span>
                    <span class="k">if</span> <span class="n">dcn</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">delta_cn_weight_estimators_rfs</span><span class="p">:</span>
                        <span class="n">this_delta_csm_weight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">delta_cn_weight_estimators_rfs</span><span class="p">[</span><span class="n">dcn</span><span class="p">]</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="n">this_delta_csm</span><span class="p">)</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="n">this_delta_csm_weight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator_rf</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="n">this_delta_csm</span><span class="p">)</span>
                    <span class="k">if</span> <span class="n">this_delta_csm_weight</span> <span class="o">&lt;</span> <span class="n">nb_set_weight</span><span class="p">:</span>
                        <span class="n">delta_csm</span> <span class="o">=</span> <span class="n">this_delta_csm</span>
                        <span class="n">delta_csm_cn_map2</span> <span class="o">=</span> <span class="p">(</span><span class="n">cn2</span><span class="p">,</span> <span class="n">inb_set2</span><span class="p">)</span>
                        <span class="n">nb_set_weight</span> <span class="o">=</span> <span class="n">this_delta_csm_weight</span>
        <span class="n">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">&#39;delta_csms&#39;</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                 <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">delta_csm</span><span class="p">)</span>
        <span class="n">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">&#39;delta_csms_weights&#39;</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                 <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">nb_set_weight</span><span class="p">)</span>
        <span class="n">set_info</span><span class="p">(</span><span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">&#39;delta_csms_cn_map2&#39;</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span>
                 <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">delta_csm_cn_map2</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">nb_set_weight</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">effective_csm_estimator</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">weight_estimator</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">delta_cn_weight_estimators</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">delta_cn_weight_estimators</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="DeltaCSMNbSetWeight.delta_cn_specifics"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaCSMNbSetWeight.delta_cn_specifics">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">delta_cn_specifics</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">delta_csm_mins</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">delta_csm_maxs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">function</span><span class="o">=</span><span class="s1">&#39;smootherstep&#39;</span><span class="p">,</span>
                           <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="s1">&#39;csm_wcs_ctwcc&#39;</span><span class="p">,</span>
                           <span class="n">effective_csm_estimator</span><span class="o">=</span><span class="n">DEFAULT_EFFECTIVE_CSM_ESTIMATOR</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">delta_csm_mins</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">delta_csm_maxs</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">delta_cn_weight_estimators</span> <span class="o">=</span> <span class="p">{</span><span class="n">dcn</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="n">function</span><span class="p">,</span>
                                                <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;delta_csm_min&#39;</span><span class="p">:</span> <span class="mf">0.25</span> <span class="o">+</span> <span class="n">dcn</span> <span class="o">*</span> <span class="mf">0.25</span><span class="p">,</span>
                                                            <span class="s1">&#39;delta_csm_max&#39;</span><span class="p">:</span> <span class="mf">5.0</span> <span class="o">+</span> <span class="n">dcn</span> <span class="o">*</span> <span class="mf">0.25</span><span class="p">}}</span> <span class="k">for</span> <span class="n">dcn</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">13</span><span class="p">)}</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">delta_cn_weight_estimators</span> <span class="o">=</span> <span class="p">{</span><span class="n">dcn</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="n">function</span><span class="p">,</span>
                                                <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;delta_csm_min&#39;</span><span class="p">:</span> <span class="n">delta_csm_mins</span><span class="p">[</span><span class="n">dcn</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span>
                                                            <span class="s1">&#39;delta_csm_max&#39;</span><span class="p">:</span> <span class="n">delta_csm_maxs</span><span class="p">[</span><span class="n">dcn</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]}}</span>
                                          <span class="k">for</span> <span class="n">dcn</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">13</span><span class="p">)}</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">effective_csm_estimator</span><span class="o">=</span><span class="n">effective_csm_estimator</span><span class="p">,</span>
                   <span class="n">weight_estimator</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="n">function</span><span class="p">,</span>
                                     <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span>
                                         <span class="s1">&#39;delta_csm_min&#39;</span><span class="p">:</span> <span class="n">delta_cn_weight_estimators</span><span class="p">[</span><span class="mi">12</span><span class="p">][</span><span class="s1">&#39;options&#39;</span><span class="p">][</span><span class="s1">&#39;delta_csm_min&#39;</span><span class="p">],</span>
                                         <span class="s1">&#39;delta_csm_max&#39;</span><span class="p">:</span> <span class="n">delta_cn_weight_estimators</span><span class="p">[</span><span class="mi">12</span><span class="p">][</span><span class="s1">&#39;options&#39;</span><span class="p">][</span><span class="s1">&#39;delta_csm_max&#39;</span><span class="p">]}},</span>
                   <span class="n">delta_cn_weight_estimators</span><span class="o">=</span><span class="n">delta_cn_weight_estimators</span><span class="p">,</span>
                   <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">symmetry_measure_type</span><span class="p">)</span></div>

<div class="viewcode-block" id="DeltaCSMNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaCSMNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;effective_csm_estimator&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">effective_csm_estimator</span><span class="p">,</span>
                <span class="s2">&quot;weight_estimator&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_estimator</span><span class="p">,</span>
                <span class="s2">&quot;delta_cn_weight_estimators&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">delta_cn_weight_estimators</span><span class="p">,</span>
                <span class="s2">&quot;symmetry_measure_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="DeltaCSMNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaCSMNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">effective_csm_estimator</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;effective_csm_estimator&#39;</span><span class="p">],</span>
                   <span class="n">weight_estimator</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_estimator&#39;</span><span class="p">],</span>
                   <span class="n">delta_cn_weight_estimators</span><span class="o">=</span><span class="p">{</span><span class="nb">int</span><span class="p">(</span><span class="n">dcn</span><span class="p">):</span> <span class="n">dcn_estimator</span>
                                               <span class="k">for</span> <span class="n">dcn</span><span class="p">,</span> <span class="n">dcn_estimator</span> <span class="ow">in</span> <span class="n">dd</span><span class="p">[</span><span class="s1">&#39;delta_cn_weight_estimators&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
                   <span class="k">if</span> <span class="p">(</span><span class="s1">&#39;delta_cn_weight_estimators&#39;</span> <span class="ow">in</span> <span class="n">dd</span> <span class="ow">and</span> <span class="n">dd</span><span class="p">[</span><span class="s1">&#39;delta_cn_weight_estimators&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                   <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;symmetry_measure_type&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="CNBiasNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CNBiasNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">CNBiasNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;CNBiasWeight&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cn_weights</span><span class="p">,</span> <span class="n">initialization_options</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">cn_weights</span> <span class="o">=</span> <span class="n">cn_weights</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">initialization_options</span> <span class="o">=</span> <span class="n">initialization_options</span>

<div class="viewcode-block" id="CNBiasNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CNBiasNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">cn_weights</span><span class="p">[</span><span class="nb">len</span><span class="p">(</span><span class="n">nb_set</span><span class="p">)]</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cn_weights</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">cn_weights</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">initialization_options</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">initialization_options</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="CNBiasNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CNBiasNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;cn_weights&quot;</span><span class="p">:</span> <span class="p">{</span><span class="nb">str</span><span class="p">(</span><span class="n">cn</span><span class="p">):</span> <span class="n">cnw</span> <span class="k">for</span> <span class="n">cn</span><span class="p">,</span> <span class="n">cnw</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">cn_weights</span><span class="o">.</span><span class="n">items</span><span class="p">()},</span>
                <span class="s2">&quot;initialization_options&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization_options</span><span class="p">,</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="CNBiasNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CNBiasNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">cn_weights</span><span class="o">=</span><span class="p">{</span><span class="nb">int</span><span class="p">(</span><span class="n">cn</span><span class="p">):</span> <span class="n">cnw</span> <span class="k">for</span> <span class="n">cn</span><span class="p">,</span> <span class="n">cnw</span> <span class="ow">in</span> <span class="n">dd</span><span class="p">[</span><span class="s1">&#39;cn_weights&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">()},</span>
                   <span class="n">initialization_options</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;initialization_options&#39;</span><span class="p">])</span></div>

<div class="viewcode-block" id="CNBiasNbSetWeight.linearly_equidistant"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CNBiasNbSetWeight.linearly_equidistant">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">linearly_equidistant</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">weight_cn1</span><span class="p">,</span> <span class="n">weight_cn13</span><span class="p">):</span>
        <span class="n">initialization_options</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;linearly_equidistant&#39;</span><span class="p">,</span>
                                  <span class="s1">&#39;weight_cn1&#39;</span><span class="p">:</span> <span class="n">weight_cn1</span><span class="p">,</span>
                                  <span class="s1">&#39;weight_cn13&#39;</span><span class="p">:</span> <span class="n">weight_cn13</span>
                                  <span class="p">}</span>
        <span class="n">dw</span> <span class="o">=</span> <span class="p">(</span><span class="n">weight_cn13</span> <span class="o">-</span> <span class="n">weight_cn1</span><span class="p">)</span> <span class="o">/</span> <span class="mf">12.0</span>
        <span class="n">cn_weights</span> <span class="o">=</span> <span class="p">{</span><span class="n">cn</span><span class="p">:</span> <span class="n">weight_cn1</span> <span class="o">+</span> <span class="p">(</span><span class="n">cn</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="n">dw</span> <span class="k">for</span> <span class="n">cn</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">14</span><span class="p">)}</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">cn_weights</span><span class="o">=</span><span class="n">cn_weights</span><span class="p">,</span> <span class="n">initialization_options</span><span class="o">=</span><span class="n">initialization_options</span><span class="p">)</span></div>

<div class="viewcode-block" id="CNBiasNbSetWeight.geometrically_equidistant"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CNBiasNbSetWeight.geometrically_equidistant">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">geometrically_equidistant</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">weight_cn1</span><span class="p">,</span> <span class="n">weight_cn13</span><span class="p">):</span>
        <span class="n">initialization_options</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;geometrically_equidistant&#39;</span><span class="p">,</span>
                                  <span class="s1">&#39;weight_cn1&#39;</span><span class="p">:</span> <span class="n">weight_cn1</span><span class="p">,</span>
                                  <span class="s1">&#39;weight_cn13&#39;</span><span class="p">:</span> <span class="n">weight_cn13</span>
                                  <span class="p">}</span>
        <span class="n">factor</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">power</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">weight_cn13</span><span class="p">)</span> <span class="o">/</span> <span class="n">weight_cn1</span><span class="p">,</span> <span class="mf">1.0</span> <span class="o">/</span> <span class="mf">12.0</span><span class="p">)</span>
        <span class="n">cn_weights</span> <span class="o">=</span> <span class="p">{</span><span class="n">cn</span><span class="p">:</span> <span class="n">weight_cn1</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">power</span><span class="p">(</span><span class="n">factor</span><span class="p">,</span> <span class="n">cn</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="k">for</span> <span class="n">cn</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">14</span><span class="p">)}</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">cn_weights</span><span class="o">=</span><span class="n">cn_weights</span><span class="p">,</span> <span class="n">initialization_options</span><span class="o">=</span><span class="n">initialization_options</span><span class="p">)</span></div>

<div class="viewcode-block" id="CNBiasNbSetWeight.explicit"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CNBiasNbSetWeight.explicit">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">explicit</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">cn_weights</span><span class="p">):</span>
        <span class="n">initialization_options</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;explicit&#39;</span><span class="p">}</span>
        <span class="k">if</span> <span class="nb">set</span><span class="p">(</span><span class="n">cn_weights</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span> <span class="o">!=</span> <span class="nb">set</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">14</span><span class="p">)):</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Weights should be provided for CN 1 to 13&#39;</span><span class="p">)</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">cn_weights</span><span class="o">=</span><span class="n">cn_weights</span><span class="p">,</span> <span class="n">initialization_options</span><span class="o">=</span><span class="n">initialization_options</span><span class="p">)</span></div>

<div class="viewcode-block" id="CNBiasNbSetWeight.from_description"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.CNBiasNbSetWeight.from_description">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_description</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">dd</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;linearly_equidistant&#39;</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">linearly_equidistant</span><span class="p">(</span><span class="n">weight_cn1</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_cn1&#39;</span><span class="p">],</span> <span class="n">weight_cn13</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_cn13&#39;</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">dd</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;geometrically_equidistant&#39;</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">geometrically_equidistant</span><span class="p">(</span><span class="n">weight_cn1</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_cn1&#39;</span><span class="p">],</span> <span class="n">weight_cn13</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_cn13&#39;</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">dd</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;explicit&#39;</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">explicit</span><span class="p">(</span><span class="n">cn_weights</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;cn_weights&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="DistanceAngleAreaNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceAngleAreaNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">DistanceAngleAreaNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;DistAngleAreaWeight&#39;</span>

    <span class="n">AC</span> <span class="o">=</span> <span class="n">AdditionalConditions</span><span class="p">()</span>
    <span class="n">DEFAULT_SURFACE_DEFINITION</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;standard_elliptic&#39;</span><span class="p">,</span>
                                  <span class="s1">&#39;distance_bounds&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;lower&#39;</span><span class="p">:</span> <span class="mf">1.2</span><span class="p">,</span> <span class="s1">&#39;upper&#39;</span><span class="p">:</span> <span class="mf">1.8</span><span class="p">},</span>
                                  <span class="s1">&#39;angle_bounds&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;lower&#39;</span><span class="p">:</span> <span class="mf">0.1</span><span class="p">,</span> <span class="s1">&#39;upper&#39;</span><span class="p">:</span> <span class="mf">0.8</span><span class="p">}}</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">weight_type</span><span class="o">=</span><span class="s1">&#39;has_intersection&#39;</span><span class="p">,</span> <span class="n">surface_definition</span><span class="o">=</span><span class="n">DEFAULT_SURFACE_DEFINITION</span><span class="p">,</span>
                 <span class="n">nb_sets_from_hints</span><span class="o">=</span><span class="s1">&#39;fallback_to_source&#39;</span><span class="p">,</span> <span class="n">other_nb_sets</span><span class="o">=</span><span class="s1">&#39;0_weight&#39;</span><span class="p">,</span>
                 <span class="n">additional_condition</span><span class="o">=</span><span class="n">AC</span><span class="o">.</span><span class="n">ONLY_ACB</span><span class="p">,</span> <span class="n">smoothstep_distance</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">smoothstep_angle</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">weight_type</span> <span class="o">=</span> <span class="n">weight_type</span>
        <span class="k">if</span> <span class="n">weight_type</span> <span class="o">==</span> <span class="s1">&#39;has_intersection&#39;</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">area_weight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">w_area_has_intersection</span>
        <span class="k">elif</span> <span class="n">weight_type</span> <span class="o">==</span> <span class="s1">&#39;has_intersection_smoothstep&#39;</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
            <span class="c1"># self.area_weight = self.w_area_has_intersection_smoothstep</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Weight type is &quot;</span><span class="si">{}</span><span class="s1">&quot; while it should be &quot;has_intersection&quot;&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">weight_type</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">surface_definition</span> <span class="o">=</span> <span class="n">surface_definition</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">nb_sets_from_hints</span> <span class="o">=</span> <span class="n">nb_sets_from_hints</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">other_nb_sets</span> <span class="o">=</span> <span class="n">other_nb_sets</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">additional_condition</span> <span class="o">=</span> <span class="n">additional_condition</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">smoothstep_distance</span> <span class="o">=</span> <span class="n">smoothstep_distance</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">smoothstep_angle</span> <span class="o">=</span> <span class="n">smoothstep_angle</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">nb_sets_from_hints</span> <span class="o">==</span> <span class="s1">&#39;fallback_to_source&#39;</span><span class="p">:</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">other_nb_sets</span> <span class="o">==</span> <span class="s1">&#39;0_weight&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">w_area_intersection_specific</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">w_area_intersection_nbsfh_fbs_onb0</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Other nb_sets should be &quot;0_weight&quot;&#39;</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Nb_sets from hints should fallback to source&#39;</span><span class="p">)</span>
        <span class="n">lower_and_upper_functions</span> <span class="o">=</span> <span class="n">get_lower_and_upper_f</span><span class="p">(</span><span class="n">surface_calculation_options</span><span class="o">=</span><span class="n">surface_definition</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">dmin</span> <span class="o">=</span> <span class="n">surface_definition</span><span class="p">[</span><span class="s1">&#39;distance_bounds&#39;</span><span class="p">][</span><span class="s1">&#39;lower&#39;</span><span class="p">]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span> <span class="o">=</span> <span class="n">surface_definition</span><span class="p">[</span><span class="s1">&#39;distance_bounds&#39;</span><span class="p">][</span><span class="s1">&#39;upper&#39;</span><span class="p">]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">amin</span> <span class="o">=</span> <span class="n">surface_definition</span><span class="p">[</span><span class="s1">&#39;angle_bounds&#39;</span><span class="p">][</span><span class="s1">&#39;lower&#39;</span><span class="p">]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">amax</span> <span class="o">=</span> <span class="n">surface_definition</span><span class="p">[</span><span class="s1">&#39;angle_bounds&#39;</span><span class="p">][</span><span class="s1">&#39;upper&#39;</span><span class="p">]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">f_lower</span> <span class="o">=</span> <span class="n">lower_and_upper_functions</span><span class="p">[</span><span class="s1">&#39;lower&#39;</span><span class="p">]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">f_upper</span> <span class="o">=</span> <span class="n">lower_and_upper_functions</span><span class="p">[</span><span class="s1">&#39;upper&#39;</span><span class="p">]</span>

<div class="viewcode-block" id="DistanceAngleAreaNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceAngleAreaNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">area_weight</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="n">structure_environments</span><span class="p">,</span>
                                <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">)</span></div>

<div class="viewcode-block" id="DistanceAngleAreaNbSetWeight.w_area_has_intersection_smoothstep"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceAngleAreaNbSetWeight.w_area_has_intersection_smoothstep">[docs]</a>    <span class="k">def</span> <span class="nf">w_area_has_intersection_smoothstep</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span>
                                           <span class="n">cn_map</span><span class="p">,</span> <span class="n">additional_info</span><span class="p">):</span>
        <span class="n">w_area</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">w_area_intersection_specific</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="n">structure_environments</span><span class="p">,</span>
                                                   <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">w_area</span> <span class="o">&gt;</span> <span class="mf">0.0</span><span class="p">:</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smoothstep_distance</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
                <span class="n">w_area</span> <span class="o">=</span> <span class="n">w_area</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smoothstep_angle</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
                <span class="n">w_area</span> <span class="o">=</span> <span class="n">w_area</span>
        <span class="k">return</span> <span class="n">w_area</span></div>

<div class="viewcode-block" id="DistanceAngleAreaNbSetWeight.w_area_has_intersection"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceAngleAreaNbSetWeight.w_area_has_intersection">[docs]</a>    <span class="k">def</span> <span class="nf">w_area_has_intersection</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span>
                                <span class="n">cn_map</span><span class="p">,</span> <span class="n">additional_info</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">w_area_intersection_specific</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="n">structure_environments</span><span class="p">,</span>
                                                 <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="n">additional_info</span><span class="p">)</span></div>

<div class="viewcode-block" id="DistanceAngleAreaNbSetWeight.w_area_intersection_nbsfh_fbs_onb0"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceAngleAreaNbSetWeight.w_area_intersection_nbsfh_fbs_onb0">[docs]</a>    <span class="k">def</span> <span class="nf">w_area_intersection_nbsfh_fbs_onb0</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span>
                                           <span class="n">cn_map</span><span class="p">,</span> <span class="n">additional_info</span><span class="p">):</span>
        <span class="n">dist_ang_sources</span> <span class="o">=</span> <span class="p">[</span><span class="n">src</span> <span class="k">for</span> <span class="n">src</span> <span class="ow">in</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">sources</span>
                            <span class="k">if</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;origin&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;dist_ang_ac_voronoi&#39;</span> <span class="ow">and</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;ac&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">additional_condition</span><span class="p">]</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">dist_ang_sources</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">for</span> <span class="n">src</span> <span class="ow">in</span> <span class="n">dist_ang_sources</span><span class="p">:</span>
                <span class="n">d1</span> <span class="o">=</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;dp_dict&#39;</span><span class="p">][</span><span class="s1">&#39;min&#39;</span><span class="p">]</span>
                <span class="n">d2</span> <span class="o">=</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;dp_dict&#39;</span><span class="p">][</span><span class="s1">&#39;next&#39;</span><span class="p">]</span>
                <span class="n">a1</span> <span class="o">=</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;ap_dict&#39;</span><span class="p">][</span><span class="s1">&#39;next&#39;</span><span class="p">]</span>
                <span class="n">a2</span> <span class="o">=</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;ap_dict&#39;</span><span class="p">][</span><span class="s1">&#39;max&#39;</span><span class="p">]</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">rectangle_crosses_area</span><span class="p">(</span><span class="n">d1</span><span class="o">=</span><span class="n">d1</span><span class="p">,</span> <span class="n">d2</span><span class="o">=</span><span class="n">d2</span><span class="p">,</span> <span class="n">a1</span><span class="o">=</span><span class="n">a1</span><span class="p">,</span> <span class="n">a2</span><span class="o">=</span><span class="n">a2</span><span class="p">):</span>
                    <span class="k">return</span> <span class="mf">1.0</span>
            <span class="k">return</span> <span class="mf">0.0</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">from_hints_sources</span> <span class="o">=</span> <span class="p">[</span><span class="n">src</span> <span class="k">for</span> <span class="n">src</span> <span class="ow">in</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">sources</span> <span class="k">if</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;origin&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;nb_set_hints&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">from_hints_sources</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                <span class="k">return</span> <span class="mf">0.0</span>
            <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">from_hints_sources</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Found multiple hints sources for nb_set&#39;</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">cn_map_src</span> <span class="o">=</span> <span class="n">from_hints_sources</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">&#39;cn_map_source&#39;</span><span class="p">]</span>
                <span class="n">nb_set_src</span> <span class="o">=</span> <span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">nb_set</span><span class="o">.</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map_src</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">cn_map_src</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span>
                <span class="n">dist_ang_sources</span> <span class="o">=</span> <span class="p">[</span><span class="n">src</span> <span class="k">for</span> <span class="n">src</span> <span class="ow">in</span> <span class="n">nb_set_src</span><span class="o">.</span><span class="n">sources</span>
                                    <span class="k">if</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;origin&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;dist_ang_ac_voronoi&#39;</span> <span class="ow">and</span>
                                    <span class="n">src</span><span class="p">[</span><span class="s1">&#39;ac&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">additional_condition</span><span class="p">]</span>
                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">dist_ang_sources</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                    <span class="k">return</span> <span class="mf">0.0</span>
                <span class="k">for</span> <span class="n">src</span> <span class="ow">in</span> <span class="n">dist_ang_sources</span><span class="p">:</span>
                    <span class="n">d1</span> <span class="o">=</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;dp_dict&#39;</span><span class="p">][</span><span class="s1">&#39;min&#39;</span><span class="p">]</span>
                    <span class="n">d2</span> <span class="o">=</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;dp_dict&#39;</span><span class="p">][</span><span class="s1">&#39;next&#39;</span><span class="p">]</span>
                    <span class="n">a1</span> <span class="o">=</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;ap_dict&#39;</span><span class="p">][</span><span class="s1">&#39;next&#39;</span><span class="p">]</span>
                    <span class="n">a2</span> <span class="o">=</span> <span class="n">src</span><span class="p">[</span><span class="s1">&#39;ap_dict&#39;</span><span class="p">][</span><span class="s1">&#39;max&#39;</span><span class="p">]</span>
                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">rectangle_crosses_area</span><span class="p">(</span><span class="n">d1</span><span class="o">=</span><span class="n">d1</span><span class="p">,</span> <span class="n">d2</span><span class="o">=</span><span class="n">d2</span><span class="p">,</span> <span class="n">a1</span><span class="o">=</span><span class="n">a1</span><span class="p">,</span> <span class="n">a2</span><span class="o">=</span><span class="n">a2</span><span class="p">):</span>
                        <span class="k">return</span> <span class="mf">1.0</span>
                <span class="k">return</span> <span class="mf">0.0</span></div>

<div class="viewcode-block" id="DistanceAngleAreaNbSetWeight.rectangle_crosses_area"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceAngleAreaNbSetWeight.rectangle_crosses_area">[docs]</a>    <span class="k">def</span> <span class="nf">rectangle_crosses_area</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">d1</span><span class="p">,</span> <span class="n">d2</span><span class="p">,</span> <span class="n">a1</span><span class="p">,</span> <span class="n">a2</span><span class="p">):</span>
        <span class="c1"># Case 1</span>
        <span class="k">if</span> <span class="n">d1</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmin</span> <span class="ow">and</span> <span class="n">d2</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmin</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">False</span>
        <span class="c1"># Case 6</span>
        <span class="k">if</span> <span class="n">d1</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span> <span class="ow">and</span> <span class="n">d2</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">False</span>
        <span class="c1"># Case 2</span>
        <span class="k">if</span> <span class="n">d1</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmin</span> <span class="ow">and</span> <span class="n">d2</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span><span class="p">:</span>
            <span class="n">ld2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f_lower</span><span class="p">(</span><span class="n">d2</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">a2</span> <span class="o">&lt;=</span> <span class="n">ld2</span> <span class="ow">or</span> <span class="n">a1</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">amax</span><span class="p">:</span>
                <span class="k">return</span> <span class="kc">False</span>
            <span class="k">return</span> <span class="kc">True</span>
        <span class="c1"># Case 3</span>
        <span class="k">if</span> <span class="n">d1</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmin</span> <span class="ow">and</span> <span class="n">d2</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">a2</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">amin</span> <span class="ow">or</span> <span class="n">a1</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">amax</span><span class="p">:</span>
                <span class="k">return</span> <span class="kc">False</span>
            <span class="k">return</span> <span class="kc">True</span>
        <span class="c1"># Case 4</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmin</span> <span class="o">&lt;=</span> <span class="n">d1</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmin</span> <span class="o">&lt;=</span> <span class="n">d2</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span><span class="p">:</span>
            <span class="n">ld1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f_lower</span><span class="p">(</span><span class="n">d1</span><span class="p">)</span>
            <span class="n">ld2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f_lower</span><span class="p">(</span><span class="n">d2</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">a2</span> <span class="o">&lt;=</span> <span class="n">ld1</span> <span class="ow">and</span> <span class="n">a2</span> <span class="o">&lt;=</span> <span class="n">ld2</span><span class="p">:</span>
                <span class="k">return</span> <span class="kc">False</span>
            <span class="n">ud1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f_upper</span><span class="p">(</span><span class="n">d1</span><span class="p">)</span>
            <span class="n">ud2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f_upper</span><span class="p">(</span><span class="n">d2</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">a1</span> <span class="o">&gt;=</span> <span class="n">ud1</span> <span class="ow">and</span> <span class="n">a1</span> <span class="o">&gt;=</span> <span class="n">ud2</span><span class="p">:</span>
                <span class="k">return</span> <span class="kc">False</span>
            <span class="k">return</span> <span class="kc">True</span>
        <span class="c1"># Case 5</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmin</span> <span class="o">&lt;=</span> <span class="n">d1</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span> <span class="ow">and</span> <span class="n">d2</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax</span><span class="p">:</span>
            <span class="n">ud1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f_upper</span><span class="p">(</span><span class="n">d1</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">a1</span> <span class="o">&gt;=</span> <span class="n">ud1</span> <span class="ow">or</span> <span class="n">a2</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">amin</span><span class="p">:</span>
                <span class="k">return</span> <span class="kc">False</span>
            <span class="k">return</span> <span class="kc">True</span>
        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Should not reach this point!&#39;</span><span class="p">)</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">weight_type</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">weight_type</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">surface_definition</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">surface_definition</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">nb_sets_from_hints</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">nb_sets_from_hints</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">other_nb_sets</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">other_nb_sets</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">additional_condition</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">additional_condition</span>
                <span class="p">)</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="DistanceAngleAreaNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceAngleAreaNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;weight_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_type</span><span class="p">,</span>
                <span class="s2">&quot;surface_definition&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">surface_definition</span><span class="p">,</span>
                <span class="s2">&quot;nb_sets_from_hints&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">nb_sets_from_hints</span><span class="p">,</span>
                <span class="s2">&quot;other_nb_sets&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">other_nb_sets</span><span class="p">,</span>
                <span class="s2">&quot;additional_condition&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">additional_condition</span><span class="p">}</span></div>

<div class="viewcode-block" id="DistanceAngleAreaNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceAngleAreaNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">weight_type</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_type&#39;</span><span class="p">],</span> <span class="n">surface_definition</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;surface_definition&#39;</span><span class="p">],</span>
                   <span class="n">nb_sets_from_hints</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;nb_sets_from_hints&#39;</span><span class="p">],</span> <span class="n">other_nb_sets</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;other_nb_sets&#39;</span><span class="p">],</span>
                   <span class="n">additional_condition</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;additional_condition&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="DistancePlateauNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistancePlateauNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">DistancePlateauNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;DistancePlateauWeight&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">distance_function</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">weight_function</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">distance_function</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">distance_function</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;normalized_distance&#39;</span><span class="p">}</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">distance_function</span> <span class="o">=</span> <span class="n">distance_function</span>
        <span class="k">if</span> <span class="n">weight_function</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;inverse_smootherstep&#39;</span><span class="p">,</span> <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;lower&#39;</span><span class="p">:</span> <span class="mf">0.2</span><span class="p">,</span> <span class="s1">&#39;upper&#39;</span><span class="p">:</span> <span class="mf">0.4</span><span class="p">}}</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span> <span class="o">=</span> <span class="n">weight_function</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">weight_rf</span> <span class="o">=</span> <span class="n">RatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span><span class="p">)</span>

<div class="viewcode-block" id="DistancePlateauNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistancePlateauNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_rf</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">distance_plateau</span><span class="p">())</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="DistancePlateauNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistancePlateauNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;distance_function&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">distance_function</span><span class="p">,</span>
                <span class="s2">&quot;weight_function&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="DistancePlateauNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistancePlateauNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">distance_function</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;distance_function&#39;</span><span class="p">],</span> <span class="n">weight_function</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_function&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="AnglePlateauNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AnglePlateauNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">AnglePlateauNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;AnglePlateauWeight&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">angle_function</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">weight_function</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">angle_function</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">angle_function</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;normalized_angle&#39;</span><span class="p">}</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">angle_function</span> <span class="o">=</span> <span class="n">angle_function</span>
        <span class="k">if</span> <span class="n">weight_function</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;inverse_smootherstep&#39;</span><span class="p">,</span> <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;lower&#39;</span><span class="p">:</span> <span class="mf">0.05</span><span class="p">,</span> <span class="s1">&#39;upper&#39;</span><span class="p">:</span> <span class="mf">0.15</span><span class="p">}}</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span> <span class="o">=</span> <span class="n">weight_function</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">weight_rf</span> <span class="o">=</span> <span class="n">RatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span><span class="p">)</span>

<div class="viewcode-block" id="AnglePlateauNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AnglePlateauNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_rf</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">angle_plateau</span><span class="p">())</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="AnglePlateauNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AnglePlateauNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;angle_function&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">angle_function</span><span class="p">,</span>
                <span class="s2">&quot;weight_function&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="AnglePlateauNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.AnglePlateauNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">angle_function</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;angle_function&#39;</span><span class="p">],</span> <span class="n">weight_function</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_function&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="DistanceNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">DistanceNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;DistanceNbSetWeight&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">weight_function</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">nbs_source</span><span class="o">=</span><span class="s1">&#39;voronoi&#39;</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">weight_function</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;smootherstep&#39;</span><span class="p">,</span> <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;lower&#39;</span><span class="p">:</span> <span class="mf">1.2</span><span class="p">,</span> <span class="s1">&#39;upper&#39;</span><span class="p">:</span> <span class="mf">1.3</span><span class="p">}}</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span> <span class="o">=</span> <span class="n">weight_function</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">weight_rf</span> <span class="o">=</span> <span class="n">RatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nbs_source</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;nb_sets&#39;</span><span class="p">,</span> <span class="s1">&#39;voronoi&#39;</span><span class="p">]:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;&quot;nbs_source&quot; should be one of [&quot;nb_sets&quot;, &quot;voronoi&quot;]&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">nbs_source</span> <span class="o">=</span> <span class="n">nbs_source</span>

<div class="viewcode-block" id="DistanceNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="n">cn</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
        <span class="n">inb_set</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
        <span class="n">isite</span> <span class="o">=</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">isite</span>
        <span class="n">voronoi</span> <span class="o">=</span> <span class="n">structure_environments</span><span class="o">.</span><span class="n">voronoi</span><span class="o">.</span><span class="n">voronoi_list2</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">nbs_source</span> <span class="o">==</span> <span class="s1">&#39;nb_sets&#39;</span><span class="p">:</span>
            <span class="n">all_nbs_voro_indices</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
            <span class="k">for</span> <span class="n">cn2</span><span class="p">,</span> <span class="n">nb_sets</span> <span class="ow">in</span> <span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
                <span class="k">for</span> <span class="n">inb_set2</span><span class="p">,</span> <span class="n">nb_set2</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_sets</span><span class="p">):</span>
                    <span class="k">if</span> <span class="n">cn</span> <span class="o">==</span> <span class="n">cn2</span> <span class="ow">and</span> <span class="n">inb_set</span> <span class="o">==</span> <span class="n">inb_set</span><span class="p">:</span>
                        <span class="k">continue</span>
                    <span class="n">all_nbs_voro_indices</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">nb_set2</span><span class="o">.</span><span class="n">site_voronoi_indices</span><span class="p">)</span>
        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">nbs_source</span> <span class="o">==</span> <span class="s2">&quot;voronoi&quot;</span><span class="p">:</span>
            <span class="n">all_nbs_voro_indices</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">voronoi</span><span class="p">)))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;&quot;nbs_source&quot; should be one of [&quot;nb_sets&quot;, &quot;voronoi&quot;]&#39;</span><span class="p">)</span>
        <span class="n">all_nbs_indices_except_nb_set</span> <span class="o">=</span> <span class="n">all_nbs_voro_indices</span><span class="o">.</span><span class="n">difference</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">site_voronoi_indices</span><span class="p">)</span>
        <span class="n">normalized_distances</span> <span class="o">=</span> <span class="p">[</span><span class="n">voronoi</span><span class="p">[</span><span class="n">inb</span><span class="p">][</span><span class="s1">&#39;normalized_distance&#39;</span><span class="p">]</span> <span class="k">for</span> <span class="n">inb</span> <span class="ow">in</span> <span class="n">all_nbs_indices_except_nb_set</span><span class="p">]</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">normalized_distances</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="mf">1.0</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_rf</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="nb">min</span><span class="p">(</span><span class="n">normalized_distances</span><span class="p">))</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="DistanceNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;weight_function&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span><span class="p">,</span>
                <span class="s2">&quot;nbs_source&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">nbs_source</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="DistanceNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DistanceNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">weight_function</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_function&#39;</span><span class="p">],</span> <span class="n">nbs_source</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;nbs_source&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="DeltaDistanceNbSetWeight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaDistanceNbSetWeight">[docs]</a><span class="k">class</span> <span class="nc">DeltaDistanceNbSetWeight</span><span class="p">(</span><span class="n">NbSetWeight</span><span class="p">):</span>
    <span class="n">SHORT_NAME</span> <span class="o">=</span> <span class="s1">&#39;DeltaDistanceNbSetWeight&#39;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">weight_function</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">nbs_source</span><span class="o">=</span><span class="s1">&#39;voronoi&#39;</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">weight_function</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;smootherstep&#39;</span><span class="p">,</span> <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;lower&#39;</span><span class="p">:</span> <span class="mf">0.1</span><span class="p">,</span> <span class="s1">&#39;upper&#39;</span><span class="p">:</span> <span class="mf">0.2</span><span class="p">}}</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span> <span class="o">=</span> <span class="n">weight_function</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">weight_rf</span> <span class="o">=</span> <span class="n">RatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nbs_source</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;nb_sets&#39;</span><span class="p">,</span> <span class="s1">&#39;voronoi&#39;</span><span class="p">]:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;&quot;nbs_source&quot; should be one of [&quot;nb_sets&quot;, &quot;voronoi&quot;]&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">nbs_source</span> <span class="o">=</span> <span class="n">nbs_source</span>

<div class="viewcode-block" id="DeltaDistanceNbSetWeight.weight"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaDistanceNbSetWeight.weight">[docs]</a>    <span class="k">def</span> <span class="nf">weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">cn_map</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="n">cn</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
        <span class="n">inb_set</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
        <span class="n">isite</span> <span class="o">=</span> <span class="n">nb_set</span><span class="o">.</span><span class="n">isite</span>
        <span class="n">voronoi</span> <span class="o">=</span> <span class="n">structure_environments</span><span class="o">.</span><span class="n">voronoi</span><span class="o">.</span><span class="n">voronoi_list2</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">nbs_source</span> <span class="o">==</span> <span class="s1">&#39;nb_sets&#39;</span><span class="p">:</span>
            <span class="n">all_nbs_voro_indices</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
            <span class="k">for</span> <span class="n">cn2</span><span class="p">,</span> <span class="n">nb_sets</span> <span class="ow">in</span> <span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
                <span class="k">for</span> <span class="n">inb_set2</span><span class="p">,</span> <span class="n">nb_set2</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_sets</span><span class="p">):</span>
                    <span class="k">if</span> <span class="n">cn</span> <span class="o">==</span> <span class="n">cn2</span> <span class="ow">and</span> <span class="n">inb_set</span> <span class="o">==</span> <span class="n">inb_set</span><span class="p">:</span>
                        <span class="k">continue</span>
                    <span class="n">all_nbs_voro_indices</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">nb_set2</span><span class="o">.</span><span class="n">site_voronoi_indices</span><span class="p">)</span>
        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">nbs_source</span> <span class="o">==</span> <span class="s2">&quot;voronoi&quot;</span><span class="p">:</span>
            <span class="n">all_nbs_voro_indices</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">voronoi</span><span class="p">)))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;&quot;nbs_source&quot; should be one of [&quot;nb_sets&quot;, &quot;voronoi&quot;]&#39;</span><span class="p">)</span>
        <span class="n">all_nbs_indices_except_nb_set</span> <span class="o">=</span> <span class="n">all_nbs_voro_indices</span><span class="o">.</span><span class="n">difference</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">site_voronoi_indices</span><span class="p">)</span>
        <span class="n">normalized_distances</span> <span class="o">=</span> <span class="p">[</span><span class="n">voronoi</span><span class="p">[</span><span class="n">inb</span><span class="p">][</span><span class="s1">&#39;normalized_distance&#39;</span><span class="p">]</span> <span class="k">for</span> <span class="n">inb</span> <span class="ow">in</span> <span class="n">all_nbs_indices_except_nb_set</span><span class="p">]</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">normalized_distances</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="mf">1.0</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">nb_set</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="mf">0.0</span>
        <span class="n">nb_set_max_normalized_distance</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">nb_set</span><span class="o">.</span><span class="n">normalized_distances</span><span class="p">)</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_rf</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="nb">min</span><span class="p">(</span><span class="n">normalized_distances</span><span class="p">)</span> <span class="o">-</span> <span class="n">nb_set_max_normalized_distance</span><span class="p">)</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="DeltaDistanceNbSetWeight.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaDistanceNbSetWeight.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;weight_function&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight_function</span><span class="p">,</span>
                <span class="s2">&quot;nbs_source&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">nbs_source</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="DeltaDistanceNbSetWeight.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.DeltaDistanceNbSetWeight.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dd</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">weight_function</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;weight_function&#39;</span><span class="p">],</span> <span class="n">nbs_source</span><span class="o">=</span><span class="n">dd</span><span class="p">[</span><span class="s1">&#39;nbs_source&#39;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="WeightedNbSetChemenvStrategy"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.WeightedNbSetChemenvStrategy">[docs]</a><span class="k">class</span> <span class="nc">WeightedNbSetChemenvStrategy</span><span class="p">(</span><span class="n">AbstractChemenvStrategy</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    WeightedNbSetChemenvStrategy</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">STRATEGY_DESCRIPTION</span> <span class="o">=</span> <span class="s1">&#39;    WeightedNbSetChemenvStrategy&#39;</span>
    <span class="n">DEFAULT_CE_ESTIMATOR</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;power2_inverse_power2_decreasing&#39;</span><span class="p">,</span>
                            <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;max_csm&#39;</span><span class="p">:</span> <span class="mf">8.0</span><span class="p">}}</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">additional_condition</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">AC</span><span class="o">.</span><span class="n">ONLY_ACB</span><span class="p">,</span>
                 <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span><span class="p">,</span>
                 <span class="n">nb_set_weights</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">ce_estimator</span><span class="o">=</span><span class="n">DEFAULT_CE_ESTIMATOR</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Constructor for the WeightedNbSetChemenvStrategy.</span>
<span class="sd">        :param structure_environments: StructureEnvironments object containing all the information on the</span>
<span class="sd">            coordination of the sites in a structure</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span> <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">symmetry_measure_type</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">=</span> <span class="n">additional_condition</span>
        <span class="k">if</span> <span class="n">nb_set_weights</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">nb_set_weights</span> <span class="o">=</span> <span class="n">nb_set_weights</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="k">for</span> <span class="n">nb_set_weight</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">nb_set_weights</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;weight&#39;</span><span class="p">:</span> <span class="n">nb_set_weight</span><span class="p">,</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="n">nb_set_weight</span><span class="o">.</span><span class="n">SHORT_NAME</span><span class="p">})</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator</span> <span class="o">=</span> <span class="n">ce_estimator</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator_ratio_function</span> <span class="o">=</span> <span class="n">CSMInfiniteRatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator_fractions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator_ratio_function</span><span class="o">.</span><span class="n">fractions</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">uniquely_determines_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="kc">False</span>

<div class="viewcode-block" id="WeightedNbSetChemenvStrategy.get_site_coordination_environments_fractions"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.WeightedNbSetChemenvStrategy.get_site_coordination_environments_fractions">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environments_fractions</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                                     <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ordered</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">min_fraction</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">return_maps</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                                                     <span class="n">return_strategy_dict_info</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">return_all</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">isite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">dequivsite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">dthissite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">mysym</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
        <span class="n">site_nb_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">neighbors_sets</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">site_nb_sets</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>
        <span class="n">cn_maps</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="k">for</span> <span class="n">cn</span><span class="p">,</span> <span class="n">nb_sets</span> <span class="ow">in</span> <span class="n">site_nb_sets</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
            <span class="k">for</span> <span class="n">inb_set</span><span class="p">,</span> <span class="n">nb_set</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">nb_sets</span><span class="p">):</span>
                <span class="c1"># CHECK THE ADDITIONAL CONDITION HERE ?</span>
                <span class="n">cn_maps</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">cn</span><span class="p">,</span> <span class="n">inb_set</span><span class="p">))</span>
        <span class="n">weights_additional_info</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;weights&#39;</span><span class="p">:</span> <span class="p">{</span><span class="n">isite</span><span class="p">:</span> <span class="p">{}}}</span>
        <span class="k">for</span> <span class="n">wdict</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span><span class="p">:</span>
            <span class="n">cn_maps_new</span> <span class="o">=</span> <span class="p">[]</span>
            <span class="n">weight</span> <span class="o">=</span> <span class="n">wdict</span><span class="p">[</span><span class="s1">&#39;weight&#39;</span><span class="p">]</span>
            <span class="n">weight_name</span> <span class="o">=</span> <span class="n">wdict</span><span class="p">[</span><span class="s1">&#39;name&#39;</span><span class="p">]</span>
            <span class="k">for</span> <span class="n">cn_map</span> <span class="ow">in</span> <span class="n">cn_maps</span><span class="p">:</span>
                <span class="n">nb_set</span> <span class="o">=</span> <span class="n">site_nb_sets</span><span class="p">[</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span>
                <span class="n">w_nb_set</span> <span class="o">=</span> <span class="n">weight</span><span class="o">.</span><span class="n">weight</span><span class="p">(</span><span class="n">nb_set</span><span class="o">=</span><span class="n">nb_set</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="p">,</span>
                                         <span class="n">cn_map</span><span class="o">=</span><span class="n">cn_map</span><span class="p">,</span> <span class="n">additional_info</span><span class="o">=</span><span class="n">weights_additional_info</span><span class="p">)</span>
                <span class="k">if</span> <span class="n">cn_map</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">]:</span>
                    <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
                <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">][</span><span class="n">weight_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">w_nb_set</span>
                <span class="k">if</span> <span class="n">return_all</span> <span class="ow">or</span> <span class="n">w_nb_set</span> <span class="o">&gt;</span> <span class="mf">0.0</span><span class="p">:</span>
                    <span class="n">cn_maps_new</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cn_map</span><span class="p">)</span>
            <span class="n">cn_maps</span> <span class="o">=</span> <span class="n">cn_maps_new</span>
        <span class="k">for</span> <span class="n">cn_map</span><span class="p">,</span> <span class="n">weights</span> <span class="ow">in</span> <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
            <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">][</span><span class="s1">&#39;Product&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">product</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">weights</span><span class="o">.</span><span class="n">values</span><span class="p">()))</span>

        <span class="n">w_nb_sets</span> <span class="o">=</span> <span class="p">{</span><span class="n">cn_map</span><span class="p">:</span> <span class="n">weights</span><span class="p">[</span><span class="s1">&#39;Product&#39;</span><span class="p">]</span>
                     <span class="k">for</span> <span class="n">cn_map</span><span class="p">,</span> <span class="n">weights</span> <span class="ow">in</span> <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
        <span class="n">w_nb_sets_total</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">w_nb_sets</span><span class="o">.</span><span class="n">values</span><span class="p">()))</span>
        <span class="n">nb_sets_fractions</span> <span class="o">=</span> <span class="p">{</span><span class="n">cn_map</span><span class="p">:</span> <span class="n">w_nb_set</span> <span class="o">/</span> <span class="n">w_nb_sets_total</span> <span class="k">for</span> <span class="n">cn_map</span><span class="p">,</span> <span class="n">w_nb_set</span> <span class="ow">in</span> <span class="n">w_nb_sets</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
        <span class="k">for</span> <span class="n">cn_map</span> <span class="ow">in</span> <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">]:</span>
            <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">][</span><span class="s1">&#39;NbSetFraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">nb_sets_fractions</span><span class="p">[</span><span class="n">cn_map</span><span class="p">]</span>
        <span class="n">ce_symbols</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">ce_dicts</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">ce_fractions</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">ce_dict_fractions</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">ce_maps</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">site_ce_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_environments</span><span class="o">.</span><span class="n">ce_list</span><span class="p">[</span><span class="n">isite</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">return_all</span><span class="p">:</span>
            <span class="k">for</span> <span class="n">cn_map</span><span class="p">,</span> <span class="n">nb_set_fraction</span> <span class="ow">in</span> <span class="n">nb_sets_fractions</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
                <span class="n">cn</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
                <span class="n">inb_set</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
                <span class="n">site_ce_nb_set</span> <span class="o">=</span> <span class="n">site_ce_list</span><span class="p">[</span><span class="n">cn</span><span class="p">][</span><span class="n">inb_set</span><span class="p">]</span>
                <span class="k">if</span> <span class="n">site_ce_nb_set</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                    <span class="k">continue</span>
                <span class="n">mingeoms</span> <span class="o">=</span> <span class="n">site_ce_nb_set</span><span class="o">.</span><span class="n">minimum_geometries</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">)</span>
                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mingeoms</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
                    <span class="n">csms</span> <span class="o">=</span> <span class="p">[</span><span class="n">ce_dict</span><span class="p">[</span><span class="s1">&#39;other_symmetry_measures&#39;</span><span class="p">][</span><span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">]</span>
                            <span class="k">for</span> <span class="n">ce_symbol</span><span class="p">,</span> <span class="n">ce_dict</span> <span class="ow">in</span> <span class="n">mingeoms</span><span class="p">]</span>
                    <span class="n">fractions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator_fractions</span><span class="p">(</span><span class="n">csms</span><span class="p">)</span>
                    <span class="k">if</span> <span class="n">fractions</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                        <span class="n">ce_symbols</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">&#39;UNCLEAR:</span><span class="si">{:d}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">cn</span><span class="p">))</span>
                        <span class="n">ce_dicts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
                        <span class="n">ce_fractions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">nb_set_fraction</span><span class="p">)</span>
                        <span class="n">all_weights</span> <span class="o">=</span> <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">]</span>
                        <span class="n">dict_fractions</span> <span class="o">=</span> <span class="p">{</span><span class="n">wname</span><span class="p">:</span> <span class="n">wvalue</span> <span class="k">for</span> <span class="n">wname</span><span class="p">,</span> <span class="n">wvalue</span> <span class="ow">in</span> <span class="n">all_weights</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
                        <span class="n">dict_fractions</span><span class="p">[</span><span class="s1">&#39;CEFraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
                        <span class="n">dict_fractions</span><span class="p">[</span><span class="s1">&#39;Fraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">nb_set_fraction</span>
                        <span class="n">ce_dict_fractions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dict_fractions</span><span class="p">)</span>
                        <span class="n">ce_maps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cn_map</span><span class="p">)</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="k">for</span> <span class="n">ifraction</span><span class="p">,</span> <span class="n">fraction</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">fractions</span><span class="p">):</span>
                            <span class="n">ce_symbols</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mingeoms</span><span class="p">[</span><span class="n">ifraction</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
                            <span class="n">ce_dicts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mingeoms</span><span class="p">[</span><span class="n">ifraction</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
                            <span class="n">ce_fractions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">nb_set_fraction</span> <span class="o">*</span> <span class="n">fraction</span><span class="p">)</span>
                            <span class="n">all_weights</span> <span class="o">=</span> <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">]</span>
                            <span class="n">dict_fractions</span> <span class="o">=</span> <span class="p">{</span><span class="n">wname</span><span class="p">:</span> <span class="n">wvalue</span> <span class="k">for</span> <span class="n">wname</span><span class="p">,</span> <span class="n">wvalue</span> <span class="ow">in</span> <span class="n">all_weights</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
                            <span class="n">dict_fractions</span><span class="p">[</span><span class="s1">&#39;CEFraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">fraction</span>
                            <span class="n">dict_fractions</span><span class="p">[</span><span class="s1">&#39;Fraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">nb_set_fraction</span> <span class="o">*</span> <span class="n">fraction</span>
                            <span class="n">ce_dict_fractions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dict_fractions</span><span class="p">)</span>
                            <span class="n">ce_maps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cn_map</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">ce_symbols</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">&#39;UNCLEAR:</span><span class="si">{:d}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">cn</span><span class="p">))</span>
                    <span class="n">ce_dicts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
                    <span class="n">ce_fractions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">nb_set_fraction</span><span class="p">)</span>
                    <span class="n">all_weights</span> <span class="o">=</span> <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">]</span>
                    <span class="n">dict_fractions</span> <span class="o">=</span> <span class="p">{</span><span class="n">wname</span><span class="p">:</span> <span class="n">wvalue</span> <span class="k">for</span> <span class="n">wname</span><span class="p">,</span> <span class="n">wvalue</span> <span class="ow">in</span> <span class="n">all_weights</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
                    <span class="n">dict_fractions</span><span class="p">[</span><span class="s1">&#39;CEFraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
                    <span class="n">dict_fractions</span><span class="p">[</span><span class="s1">&#39;Fraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">nb_set_fraction</span>
                    <span class="n">ce_dict_fractions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dict_fractions</span><span class="p">)</span>
                    <span class="n">ce_maps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cn_map</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">for</span> <span class="n">cn_map</span><span class="p">,</span> <span class="n">nb_set_fraction</span> <span class="ow">in</span> <span class="n">nb_sets_fractions</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
                <span class="k">if</span> <span class="n">nb_set_fraction</span> <span class="o">&gt;</span> <span class="mf">0.0</span><span class="p">:</span>
                    <span class="n">cn</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
                    <span class="n">inb_set</span> <span class="o">=</span> <span class="n">cn_map</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
                    <span class="n">site_ce_nb_set</span> <span class="o">=</span> <span class="n">site_ce_list</span><span class="p">[</span><span class="n">cn</span><span class="p">][</span><span class="n">inb_set</span><span class="p">]</span>
                    <span class="n">mingeoms</span> <span class="o">=</span> <span class="n">site_ce_nb_set</span><span class="o">.</span><span class="n">minimum_geometries</span><span class="p">(</span><span class="n">symmetry_measure_type</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">)</span>
                    <span class="n">csms</span> <span class="o">=</span> <span class="p">[</span><span class="n">ce_dict</span><span class="p">[</span><span class="s1">&#39;other_symmetry_measures&#39;</span><span class="p">][</span><span class="bp">self</span><span class="o">.</span><span class="n">_symmetry_measure_type</span><span class="p">]</span>
                            <span class="k">for</span> <span class="n">ce_symbol</span><span class="p">,</span> <span class="n">ce_dict</span> <span class="ow">in</span> <span class="n">mingeoms</span><span class="p">]</span>
                    <span class="n">fractions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator_fractions</span><span class="p">(</span><span class="n">csms</span><span class="p">)</span>
                    <span class="k">for</span> <span class="n">ifraction</span><span class="p">,</span> <span class="n">fraction</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">fractions</span><span class="p">):</span>
                        <span class="k">if</span> <span class="n">fraction</span> <span class="o">&gt;</span> <span class="mf">0.0</span><span class="p">:</span>
                            <span class="n">ce_symbols</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mingeoms</span><span class="p">[</span><span class="n">ifraction</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
                            <span class="n">ce_dicts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mingeoms</span><span class="p">[</span><span class="n">ifraction</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
                            <span class="n">ce_fractions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">nb_set_fraction</span> <span class="o">*</span> <span class="n">fraction</span><span class="p">)</span>
                            <span class="n">all_weights</span> <span class="o">=</span> <span class="n">weights_additional_info</span><span class="p">[</span><span class="s1">&#39;weights&#39;</span><span class="p">][</span><span class="n">isite</span><span class="p">][</span><span class="n">cn_map</span><span class="p">]</span>
                            <span class="n">dict_fractions</span> <span class="o">=</span> <span class="p">{</span><span class="n">wname</span><span class="p">:</span> <span class="n">wvalue</span> <span class="k">for</span> <span class="n">wname</span><span class="p">,</span> <span class="n">wvalue</span> <span class="ow">in</span> <span class="n">all_weights</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
                            <span class="n">dict_fractions</span><span class="p">[</span><span class="s1">&#39;CEFraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">fraction</span>
                            <span class="n">dict_fractions</span><span class="p">[</span><span class="s1">&#39;Fraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">nb_set_fraction</span> <span class="o">*</span> <span class="n">fraction</span>
                            <span class="n">ce_dict_fractions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dict_fractions</span><span class="p">)</span>
                            <span class="n">ce_maps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cn_map</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">ordered</span><span class="p">:</span>
            <span class="n">indices</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">argsort</span><span class="p">(</span><span class="n">ce_fractions</span><span class="p">)[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">indices</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">ce_fractions</span><span class="p">)))</span>

        <span class="n">fractions_info_list</span> <span class="o">=</span> <span class="p">[</span>
            <span class="p">{</span><span class="s1">&#39;ce_symbol&#39;</span><span class="p">:</span> <span class="n">ce_symbols</span><span class="p">[</span><span class="n">ii</span><span class="p">],</span> <span class="s1">&#39;ce_dict&#39;</span><span class="p">:</span> <span class="n">ce_dicts</span><span class="p">[</span><span class="n">ii</span><span class="p">],</span> <span class="s1">&#39;ce_fraction&#39;</span><span class="p">:</span> <span class="n">ce_fractions</span><span class="p">[</span><span class="n">ii</span><span class="p">]}</span>
            <span class="k">for</span> <span class="n">ii</span> <span class="ow">in</span> <span class="n">indices</span> <span class="k">if</span> <span class="n">ce_fractions</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="n">min_fraction</span><span class="p">]</span>

        <span class="k">if</span> <span class="n">return_maps</span><span class="p">:</span>
            <span class="k">for</span> <span class="n">ifinfo</span><span class="p">,</span> <span class="n">ii</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">indices</span><span class="p">):</span>
                <span class="k">if</span> <span class="n">ce_fractions</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="n">min_fraction</span><span class="p">:</span>
                    <span class="n">fractions_info_list</span><span class="p">[</span><span class="n">ifinfo</span><span class="p">][</span><span class="s1">&#39;ce_map&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ce_maps</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">return_strategy_dict_info</span><span class="p">:</span>
            <span class="k">for</span> <span class="n">ifinfo</span><span class="p">,</span> <span class="n">ii</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">indices</span><span class="p">):</span>
                <span class="k">if</span> <span class="n">ce_fractions</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="n">min_fraction</span><span class="p">:</span>
                    <span class="n">fractions_info_list</span><span class="p">[</span><span class="n">ifinfo</span><span class="p">][</span><span class="s1">&#39;strategy_info&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ce_dict_fractions</span><span class="p">[</span><span class="n">ii</span><span class="p">]</span>
        <span class="k">return</span> <span class="n">fractions_info_list</span></div>

<div class="viewcode-block" id="WeightedNbSetChemenvStrategy.get_site_coordination_environment"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.WeightedNbSetChemenvStrategy.get_site_coordination_environment">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">):</span>
        <span class="k">pass</span></div>

<div class="viewcode-block" id="WeightedNbSetChemenvStrategy.get_site_neighbors"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.WeightedNbSetChemenvStrategy.get_site_neighbors">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_neighbors</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">):</span>
        <span class="k">pass</span></div>

<div class="viewcode-block" id="WeightedNbSetChemenvStrategy.get_site_coordination_environments"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.WeightedNbSetChemenvStrategy.get_site_coordination_environments">[docs]</a>    <span class="k">def</span> <span class="nf">get_site_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dthissite</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                                           <span class="n">return_maps</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">isite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">dequivsite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">dthissite</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">mysym</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="p">[</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="p">,</span> <span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">equivalent_site_index_and_transform</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
        <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">get_site_coordination_environment</span><span class="p">(</span><span class="n">site</span><span class="o">=</span><span class="n">site</span><span class="p">,</span> <span class="n">isite</span><span class="o">=</span><span class="n">isite</span><span class="p">,</span> <span class="n">dequivsite</span><span class="o">=</span><span class="n">dequivsite</span><span class="p">,</span>
                                                       <span class="n">dthissite</span><span class="o">=</span><span class="n">dthissite</span><span class="p">,</span> <span class="n">mysym</span><span class="o">=</span><span class="n">mysym</span><span class="p">,</span> <span class="n">return_map</span><span class="o">=</span><span class="n">return_maps</span><span class="p">)]</span></div>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">nb_set_weights</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">nb_set_weights</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">ce_estimator</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="WeightedNbSetChemenvStrategy.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.WeightedNbSetChemenvStrategy.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Bson-serializable dict representation of the WeightedNbSetChemenvStrategy object.</span>
<span class="sd">        :return: Bson-serializable dict representation of the WeightedNbSetChemenvStrategy object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;additional_condition&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span><span class="p">,</span>
                <span class="s2">&quot;symmetry_measure_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">,</span>
                <span class="s2">&quot;nb_set_weights&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">nb_set_weight</span><span class="o">.</span><span class="n">as_dict</span><span class="p">()</span> <span class="k">for</span> <span class="n">nb_set_weight</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">nb_set_weights</span><span class="p">],</span>
                <span class="s2">&quot;ce_estimator&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator</span><span class="p">,</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="WeightedNbSetChemenvStrategy.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.WeightedNbSetChemenvStrategy.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Reconstructs the WeightedNbSetChemenvStrategy object from a dict representation of the</span>
<span class="sd">        WeightedNbSetChemenvStrategy object created using the as_dict method.</span>
<span class="sd">        :param d: dict representation of the WeightedNbSetChemenvStrategy object</span>
<span class="sd">        :return: WeightedNbSetChemenvStrategy object</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">additional_condition</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;additional_condition&quot;</span><span class="p">],</span>
                   <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;symmetry_measure_type&quot;</span><span class="p">],</span>
                   <span class="n">nb_set_weights</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;nb_set_weights&quot;</span><span class="p">],</span>
                   <span class="n">ce_estimator</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;ce_estimator&quot;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="MultiWeightsChemenvStrategy"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.MultiWeightsChemenvStrategy">[docs]</a><span class="k">class</span> <span class="nc">MultiWeightsChemenvStrategy</span><span class="p">(</span><span class="n">WeightedNbSetChemenvStrategy</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    MultiWeightsChemenvStrategy</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">STRATEGY_DESCRIPTION</span> <span class="o">=</span> <span class="s1">&#39;    Multi Weights ChemenvStrategy&#39;</span>
    <span class="c1"># STRATEGY_INFO_FIELDS = [&#39;cn_map_surface_fraction&#39;, &#39;cn_map_surface_weight&#39;,</span>
    <span class="c1">#                         &#39;cn_map_mean_csm&#39;, &#39;cn_map_csm_weight&#39;,</span>
    <span class="c1">#                         &#39;cn_map_delta_csm&#39;, &#39;cn_map_delta_csms_cn_map2&#39;, &#39;cn_map_delta_csm_weight&#39;,</span>
    <span class="c1">#                         &#39;cn_map_cn_weight&#39;,</span>
    <span class="c1">#                         &#39;cn_map_fraction&#39;, &#39;cn_map_ce_fraction&#39;, &#39;ce_fraction&#39;]</span>
    <span class="n">DEFAULT_CE_ESTIMATOR</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;power2_inverse_power2_decreasing&#39;</span><span class="p">,</span>
                            <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;max_csm&#39;</span><span class="p">:</span> <span class="mf">8.0</span><span class="p">}}</span>
    <span class="n">DEFAULT_DIST_ANG_AREA_WEIGHT</span> <span class="o">=</span> <span class="p">{}</span>  <span class="c1"># type: Dict</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">additional_condition</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">AC</span><span class="o">.</span><span class="n">ONLY_ACB</span><span class="p">,</span>
                 <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">AbstractChemenvStrategy</span><span class="o">.</span><span class="n">DEFAULT_SYMMETRY_MEASURE_TYPE</span><span class="p">,</span>
                 <span class="n">dist_ang_area_weight</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">self_csm_weight</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">delta_csm_weight</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">cn_bias_weight</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">angle_weight</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">normalized_angle_distance_weight</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">ce_estimator</span><span class="o">=</span><span class="n">DEFAULT_CE_ESTIMATOR</span>
                 <span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Constructor for the MultiWeightsChemenvStrategy.</span>
<span class="sd">        :param structure_environments: StructureEnvironments object containing all the information on the</span>
<span class="sd">            coordination of the sites in a structure</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">=</span> <span class="n">additional_condition</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">dist_ang_area_weight</span> <span class="o">=</span> <span class="n">dist_ang_area_weight</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">angle_weight</span> <span class="o">=</span> <span class="n">angle_weight</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">normalized_angle_distance_weight</span> <span class="o">=</span> <span class="n">normalized_angle_distance_weight</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">self_csm_weight</span> <span class="o">=</span> <span class="n">self_csm_weight</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">delta_csm_weight</span> <span class="o">=</span> <span class="n">delta_csm_weight</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">cn_bias_weight</span> <span class="o">=</span> <span class="n">cn_bias_weight</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">nb_sets_weights</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="k">if</span> <span class="n">dist_ang_area_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;weight&#39;</span><span class="p">:</span> <span class="n">dist_ang_area_weight</span><span class="p">,</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;DistAngArea&#39;</span><span class="p">})</span>
            <span class="n">nb_sets_weights</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dist_ang_area_weight</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">self_csm_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;weight&#39;</span><span class="p">:</span> <span class="n">self_csm_weight</span><span class="p">,</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;SelfCSM&#39;</span><span class="p">})</span>
            <span class="n">nb_sets_weights</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">self_csm_weight</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">delta_csm_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;weight&#39;</span><span class="p">:</span> <span class="n">delta_csm_weight</span><span class="p">,</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;DeltaCSM&#39;</span><span class="p">})</span>
            <span class="n">nb_sets_weights</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">delta_csm_weight</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">cn_bias_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;weight&#39;</span><span class="p">:</span> <span class="n">cn_bias_weight</span><span class="p">,</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;CNBias&#39;</span><span class="p">})</span>
            <span class="n">nb_sets_weights</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cn_bias_weight</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">angle_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;weight&#39;</span><span class="p">:</span> <span class="n">angle_weight</span><span class="p">,</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Angle&#39;</span><span class="p">})</span>
            <span class="n">nb_sets_weights</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">angle_weight</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">normalized_angle_distance_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">ordered_weights</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;weight&#39;</span><span class="p">:</span> <span class="n">normalized_angle_distance_weight</span><span class="p">,</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;NormalizedAngDist&#39;</span><span class="p">})</span>
            <span class="n">nb_sets_weights</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">normalized_angle_distance_weight</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator</span> <span class="o">=</span> <span class="n">ce_estimator</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator_ratio_function</span> <span class="o">=</span> <span class="n">CSMInfiniteRatioFunction</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator_fractions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator_ratio_function</span><span class="o">.</span><span class="n">fractions</span>
        <span class="n">WeightedNbSetChemenvStrategy</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">structure_environments</span><span class="p">,</span>
                                              <span class="n">additional_condition</span><span class="o">=</span><span class="n">additional_condition</span><span class="p">,</span>
                                              <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">symmetry_measure_type</span><span class="p">,</span>
                                              <span class="n">nb_set_weights</span><span class="o">=</span><span class="n">nb_sets_weights</span><span class="p">,</span>
                                              <span class="n">ce_estimator</span><span class="o">=</span><span class="n">ce_estimator</span><span class="p">)</span>

<div class="viewcode-block" id="MultiWeightsChemenvStrategy.stats_article_weights_parameters"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.MultiWeightsChemenvStrategy.stats_article_weights_parameters">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">stats_article_weights_parameters</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span>
        <span class="n">self_csm_weight</span> <span class="o">=</span> <span class="n">SelfCSMNbSetWeight</span><span class="p">(</span><span class="n">weight_estimator</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;function&#39;</span><span class="p">:</span> <span class="s1">&#39;power2_decreasing_exp&#39;</span><span class="p">,</span>
                                                               <span class="s1">&#39;options&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;max_csm&#39;</span><span class="p">:</span> <span class="mf">8.0</span><span class="p">,</span>
                                                                           <span class="s1">&#39;alpha&#39;</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">}})</span>
        <span class="n">surface_definition</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;standard_elliptic&#39;</span><span class="p">,</span>
                              <span class="s1">&#39;distance_bounds&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;lower&#39;</span><span class="p">:</span> <span class="mf">1.15</span><span class="p">,</span> <span class="s1">&#39;upper&#39;</span><span class="p">:</span> <span class="mf">2.0</span><span class="p">},</span>
                              <span class="s1">&#39;angle_bounds&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;lower&#39;</span><span class="p">:</span> <span class="mf">0.05</span><span class="p">,</span> <span class="s1">&#39;upper&#39;</span><span class="p">:</span> <span class="mf">0.75</span><span class="p">}}</span>
        <span class="n">da_area_weight</span> <span class="o">=</span> <span class="n">DistanceAngleAreaNbSetWeight</span><span class="p">(</span><span class="n">weight_type</span><span class="o">=</span><span class="s1">&#39;has_intersection&#39;</span><span class="p">,</span>
                                                      <span class="n">surface_definition</span><span class="o">=</span><span class="n">surface_definition</span><span class="p">,</span>
                                                      <span class="n">nb_sets_from_hints</span><span class="o">=</span><span class="s1">&#39;fallback_to_source&#39;</span><span class="p">,</span>
                                                      <span class="n">other_nb_sets</span><span class="o">=</span><span class="s1">&#39;0_weight&#39;</span><span class="p">,</span>
                                                      <span class="n">additional_condition</span><span class="o">=</span><span class="n">DistanceAngleAreaNbSetWeight</span><span class="o">.</span><span class="n">AC</span><span class="o">.</span><span class="n">ONLY_ACB</span><span class="p">)</span>
        <span class="n">symmetry_measure_type</span> <span class="o">=</span> <span class="s1">&#39;csm_wcs_ctwcc&#39;</span>
        <span class="n">delta_weight</span> <span class="o">=</span> <span class="n">DeltaCSMNbSetWeight</span><span class="o">.</span><span class="n">delta_cn_specifics</span><span class="p">()</span>
        <span class="n">bias_weight</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="n">angle_weight</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="n">nad_weight</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">dist_ang_area_weight</span><span class="o">=</span><span class="n">da_area_weight</span><span class="p">,</span>
                   <span class="n">self_csm_weight</span><span class="o">=</span><span class="n">self_csm_weight</span><span class="p">,</span>
                   <span class="n">delta_csm_weight</span><span class="o">=</span><span class="n">delta_weight</span><span class="p">,</span>
                   <span class="n">cn_bias_weight</span><span class="o">=</span><span class="n">bias_weight</span><span class="p">,</span>
                   <span class="n">angle_weight</span><span class="o">=</span><span class="n">angle_weight</span><span class="p">,</span>
                   <span class="n">normalized_angle_distance_weight</span><span class="o">=</span><span class="n">nad_weight</span><span class="p">,</span>
                   <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">symmetry_measure_type</span><span class="p">)</span></div>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">uniquely_determines_coordination_environments</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="kc">False</span>

    <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">_additional_condition</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">symmetry_measure_type</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">dist_ang_area_weight</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">dist_ang_area_weight</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">self_csm_weight</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">self_csm_weight</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">delta_csm_weight</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">delta_csm_weight</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">cn_bias_weight</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">cn_bias_weight</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">angle_weight</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">angle_weight</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">normalized_angle_distance_weight</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">normalized_angle_distance_weight</span> <span class="ow">and</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">ce_estimator</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
        <span class="k">return</span> <span class="ow">not</span> <span class="bp">self</span> <span class="o">==</span> <span class="n">other</span>

<div class="viewcode-block" id="MultiWeightsChemenvStrategy.as_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.MultiWeightsChemenvStrategy.as_dict">[docs]</a>    <span class="k">def</span> <span class="nf">as_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Bson-serializable dict representation of the MultiWeightsChemenvStrategy object.</span>
<span class="sd">        :return: Bson-serializable dict representation of the MultiWeightsChemenvStrategy object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;@module&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span><span class="p">,</span>
                <span class="s2">&quot;@class&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span>
                <span class="s2">&quot;additional_condition&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_additional_condition</span><span class="p">,</span>
                <span class="s2">&quot;symmetry_measure_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">symmetry_measure_type</span><span class="p">,</span>
                <span class="s2">&quot;dist_ang_area_weight&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">dist_ang_area_weight</span><span class="o">.</span><span class="n">as_dict</span><span class="p">()</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dist_ang_area_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                <span class="s2">&quot;self_csm_weight&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">self_csm_weight</span><span class="o">.</span><span class="n">as_dict</span><span class="p">()</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">self_csm_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                <span class="s2">&quot;delta_csm_weight&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">delta_csm_weight</span><span class="o">.</span><span class="n">as_dict</span><span class="p">()</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">delta_csm_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                <span class="s2">&quot;cn_bias_weight&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">cn_bias_weight</span><span class="o">.</span><span class="n">as_dict</span><span class="p">()</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cn_bias_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                <span class="s2">&quot;angle_weight&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">angle_weight</span><span class="o">.</span><span class="n">as_dict</span><span class="p">()</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">angle_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                <span class="s2">&quot;normalized_angle_distance_weight&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalized_angle_distance_weight</span><span class="o">.</span><span class="n">as_dict</span><span class="p">()</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalized_angle_distance_weight</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                <span class="s2">&quot;ce_estimator&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">ce_estimator</span><span class="p">,</span>
                <span class="p">}</span></div>

<div class="viewcode-block" id="MultiWeightsChemenvStrategy.from_dict"><a class="viewcode-back" href="../../../../../pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.html#pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies.MultiWeightsChemenvStrategy.from_dict">[docs]</a>    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Reconstructs the MultiWeightsChemenvStrategy object from a dict representation of the</span>
<span class="sd">        MultipleAbundanceChemenvStrategy object created using the as_dict method.</span>
<span class="sd">        :param d: dict representation of the MultiWeightsChemenvStrategy object</span>
<span class="sd">        :return: MultiWeightsChemenvStrategy object</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="n">d</span><span class="p">[</span><span class="s2">&quot;normalized_angle_distance_weight&quot;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">nad_w</span> <span class="o">=</span> <span class="n">NormalizedAngleDistanceNbSetWeight</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;normalized_angle_distance_weight&quot;</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">nad_w</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">additional_condition</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;additional_condition&quot;</span><span class="p">],</span>
                   <span class="n">symmetry_measure_type</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;symmetry_measure_type&quot;</span><span class="p">],</span>
                   <span class="n">dist_ang_area_weight</span><span class="o">=</span><span class="n">DistanceAngleAreaNbSetWeight</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;dist_ang_area_weight&quot;</span><span class="p">])</span>
                   <span class="k">if</span> <span class="n">d</span><span class="p">[</span><span class="s2">&quot;dist_ang_area_weight&quot;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                   <span class="n">self_csm_weight</span><span class="o">=</span><span class="n">SelfCSMNbSetWeight</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;self_csm_weight&quot;</span><span class="p">])</span>
                   <span class="k">if</span> <span class="n">d</span><span class="p">[</span><span class="s2">&quot;self_csm_weight&quot;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                   <span class="n">delta_csm_weight</span><span class="o">=</span><span class="n">DeltaCSMNbSetWeight</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;delta_csm_weight&quot;</span><span class="p">])</span>
                   <span class="k">if</span> <span class="n">d</span><span class="p">[</span><span class="s2">&quot;delta_csm_weight&quot;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                   <span class="n">cn_bias_weight</span><span class="o">=</span><span class="n">CNBiasNbSetWeight</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;cn_bias_weight&quot;</span><span class="p">])</span>
                   <span class="k">if</span> <span class="n">d</span><span class="p">[</span><span class="s2">&quot;cn_bias_weight&quot;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                   <span class="n">angle_weight</span><span class="o">=</span><span class="n">AngleNbSetWeight</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;angle_weight&quot;</span><span class="p">])</span>
                   <span class="k">if</span> <span class="n">d</span><span class="p">[</span><span class="s2">&quot;angle_weight&quot;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span>
                   <span class="n">normalized_angle_distance_weight</span><span class="o">=</span><span class="n">nad_w</span><span class="p">,</span>
                   <span class="n">ce_estimator</span><span class="o">=</span><span class="n">d</span><span class="p">[</span><span class="s2">&quot;ce_estimator&quot;</span><span class="p">])</span></div></div>
</pre></div>

            <div class="clearer"></div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../../../index.html">pymatgen 2020.7.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../../../index.html" >Module code</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../../../../pymatgen.html" >pymatgen</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies</a></li> 
      </ul>
    </div>

    <div class="footer" role="contentinfo">
        &#169; Copyright 2011, Pymatgen Development Team.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.1.2.
    </div>
<div class="footer">This page uses <a href="http://analytics.google.com/">
Google Analytics</a> to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.
<script type="text/javascript">
  (function() {
    var ga = document.createElement('script');
    ga.src = ('https:' == document.location.protocol ?
              'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    ga.setAttribute('async', 'true');
    document.documentElement.firstChild.appendChild(ga);
  })();
</script>
</div>

  </body>
</html>